-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error LNK2001: unresolved external symbol __declspec(dllimport) #194
Comments
Thanks for reporting. All of the import / export handling is done through generate_export_header(), which generates influxdb_export.h and related macros. The docs don't mention any additional settings or defines needed for MSVC. I don't have a MSVC around to check the generated file, but I assume it should look similar to GCC / Clang. The attached log contains many other errors, could they lead to the linker issues listed above? |
Yes, when I using the way influxdb-cxx#installation to build |
Doing a quick diff between both version I can't see any reason for the linker issues, the export related settings haven't changed. Only SOVERSION introduced with 0.7.0, which seems to work different on Windows. Can you bisect the commit introducing the linker issues? |
Sorry I'm late (on vacation), do you mean that you want me to separate error LNK2001 and LNK2019 into two issues? But they are all caused by the same reason. If I misunderstood something, please correct me. |
No, the issue is fine :-) --> Doing a Git Bisect to determine the commit which may have introduced the linker issues. Let me know if you need some help here. |
I found the commit where the error occurred for the first time: 4f1f45e
Just to be on the safe side, I also tried the commits before and after it to make sure it was the culprit. |
Thanks! So introducing neither the SOVERSION is the reason, nor are there any import / export related changes. The commit replaces one library with another without touching much code (except HTTP). I don't understand how this affects, eg. TCP not finding
|
I don't have a clue either🙁 |
Could the changes to src/CMakeList.txt in the mentioned commit cause the problem? Maybe MSVC doesn't cope with object libraries? |
I'm not sure...but I'd be happy to verify your patch if you have an idea.
In general, when using object libraries as dependencies of other targets, MSVC will automatically include the object files into the final executable or library during the linking phase. |
Is there even a difference between the broken commit and the commit before? |
I have same errors if trying to build from @MonicaLiu0311 Do you observe the same problem with queries to databases? |
Sounds like it was built without boost. |
I suppose it is built with boost. In other case |
@offa, anyway I can't build the library on Windows. Could you please point me in the right direction. |
Thanks for the clarification, it wasn't clear from the comment what type of exception. I'm no MSVC dev, but following the steps described in the Readme should work there too. There's a CI build for MSVC; it uses Conan to ship dependencies but maybe you can use it a a reference. Can you describe the steps you use? |
My project is deeply tied with vcpkg. So steps are:
I tried to set flags |
After several unsuccessful attempts I have built the lib and my project with vcpkg and conan as well. @offa Thanks a lot for the reference to the solution. |
Great to hear! :-) |
@MonicaLiu0311 is this solved for you? |
Still the same error. |
Hi there! Upon investigation, the issue is caused by the
The So the behaviour of Simular issues are reported:
however no solution is provided. My recommendation based on looking at https://github.com/offa/influxdb-cxx/blob/master/src/CMakeLists.txt would be perhaps to have a single target with all the sources, rather than separate object targets - given how few files are involved, and the conditionals can still be kept. |
Thanks, this indeed could explain the issue. |
There's a test on |
ℹ️ If someone has a MSVC around, please give #245 a try. |
Hello, I am the maintainer of vcpkg. In the process of updating to
v0.7.1
, I found the following error. After investigation, I found thatInfluxDB_EXPORTS
was not defined during dynamic linking, which caused it to execute__declspec(dllimport)
.For further confirmation, I abandoned vcpkg, built your library separately, and found the same error. See the attachment for details:
error.log
Related PR: microsoft/vcpkg#31145
The text was updated successfully, but these errors were encountered: