-
Notifications
You must be signed in to change notification settings - Fork 439
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
Build error on Windows 11 - Visual Studio community 2022 - Cmake 3.29.6 #500
Comments
Is this with the new v1.4.0? |
Hi fpaglughi, Yes, with the v1.4.0. I've tried also the dev branch. |
OK, It's looking like the problem is with the build instructions in the README, combined with the new version being more strict about what it links against. Now the shared C++ library only links against the shared C library, and static against static. I may loosen this up a bit, but want to avoid some linker problems when mixing these. Anyway, the problem is probably that the C library is being built just with the shared DLL, but not that static library, and the C++ library is being built the other way (static but not shared). The easiest way to avoid this problem is to build both libraries together using the The instructions are near the top of the README and generally apply to all platforms. This is the new recommended way to build the C & C++ libraries when you will primarily just be using the C++ API.
But you can still both of them separately. On Windows you will just need to be sure to configure and build the static libraries (or turn on shared and turn off static for both libraries). To build the static libraries for Paho C, just re-run CMake with After that, just recompile the C++ library and it should build fine. In the meantime, assuming that works, lets keep this issue open to remind me to fix the README. |
Oh, no, wait... I was sure I tested all the combinations, but I was more concerned with getting It appears that if you enable both targets (shared and static) in the Paho C library, it is building the static libraries but not exporting the As a quick fix, rebuild the Paho C library with static turned on and shared turned off, Sorry about the confusion. I will try to figure out the problem in the C library build and send a PR upstream. |
OK. I sent a PR to the upstream Paho C lib. |
Thanks Frank! The workaround works, build ok! |
bulid success,thinks from swpu😆 |
I am trying to get this working on Alpine and having similar issues but once I try the paho_c bundled, shared=off static=on config, I get errors about missing CMakeLists.txt This was a mature building project before, kinda bummed about this.
|
Hello All, I have used following steps to build and install the Paho C and C++, and wanted to link the libraries to the C++ Project. C++ (For this I have used the following release - paho.mqtt.cpp-1.4.1 (the only version worked for me) ) The following is my CmakeList.txt where I also using the async for the target linking of libs And I also added my test example for tesing this MQTT publisher, - I have the following build error which I am not able to resolve for the past days - paho-mqttpp3-static.lib(async_client.obj) : error LNK2019: unresolved external symbol _Cnd_timedwait_for referenced in function "public: bool __cdecl std::condition_variable::wait_for<__int64,struct std::ratio<1,1000>,class <lambda_8753e8241f2a5a762f79a862fae56c72> >(class std::unique_lock &,class std::chrono::duration<__int64,struct std::ratio<1,1000> > const &,class <lambda_8753e8241f2a5a762f79a862fae56c72>)" (??$wait_for@_JU?$ratio@$00$0DOI@@std@@v<lambda_8753e8241f2a5a762f79a862fae56c72>@@@condition_variable@std@@QEAA_NAEAV?$unique_lock@Vmutex@std@@@1@AEBV?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@1@V<lambda_8753e8241f2a5a762f79a862fae56c72>@@@z) I would appreciate some suggestion and support here on where I have made things wrong, also I couldnt find much possibilities for installing the dlls, also if you ans this in the side. Thank you much. |
Previously, I successfully built using gcc/g++on a Linux system, but did not use VS. I hope these points can help you: |
Hi, I've followed the instructions for building paho.mqtt.c and then paco.mqtt.cpp.
I can build paho.mqtt.c, but when I try to build paco.mqtt.cpp I always get this error:
cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=C:\mqtt\paho-cpp -DPAHO_BUILD_SAMPLES=ON -DPAHO_WITH_SSL=OFF -DCMAKE_PREFIX_PATH=C:\mqtt\paho-c
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- Configuring done (0.2s)
CMake Error at src/CMakeLists.txt:82 (target_link_libraries):
Target "paho-mqttpp3-static" links to:
but the target was not found. Possible reasons include:
-- Generating done (1.7s)
CMake Generate step failed. Build files cannot be regenerated correctly.
The text was updated successfully, but these errors were encountered: