Skip to content
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

Linking issues on Visual Studio 9 #2937

Open
ilciavo opened this issue Oct 26, 2023 · 0 comments
Open

Linking issues on Visual Studio 9 #2937

ilciavo opened this issue Oct 26, 2023 · 0 comments

Comments

@ilciavo
Copy link

ilciavo commented Oct 26, 2023

Versions:
Mosquito version 2.0.18
Windows 10 Visual Studio 9

openssl and pthread libraries were installed with vcpkg as follows:

./vcpkg install openssl:x64-windows
./vcpkg install pthread:x64-windows

This results in the following linking errors:

Error LNK2001 unresolved external symbol pthread_mutex_lock
Error LNK2001 unresolved external symbol pthread_mutex_unlock
Error LNK2019 unresolved external symbol pthread_testcancel referenced in function
Error LNK2019 unresolved external symbol pthread_equal referenced in function mosquitto__destroy Error LNK2019 unresolved external symbol pthread_join referenced in function mosquitto__destroy Error LNK2019 unresolved external symbol pthread_self referenced in function mosquitto_new
Error LNK2019 unresolved external symbol pthread_cancel referenced in function mosquitto__destroy Error LNK2019 unresolved external symbol pthread_mutex_init referenced in function mosquitto_reinitialise
Error LNK2019 unresolved external symbol pthread_mutex_destroy referenced in function mosquitto__destroy
Error LNK2019 unresolved external symbol pthread_create referenced in function mosquitto_loop_start

The issue can be solved by updating CMakeLists.txt

#find_package(Threads REQUIRED)
#set (PTHREAD_LIBRARIES Threads::Threads)
find_package(PThreads4W REQUIRED)
set (PTHREAD_LIBRARIES PThreads4W::PThreads4W)

I can create a pull request if anyone is having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant