Reputation: 81
I have got a small async udp server - RiDE.
And i can't build it with CMake. When i trying to i get errors:
undefined reference to 'uv_default_loop'
undefined reference to 'uv_udp_init'
...(other libuv functions)
But when i build it with command like this:
gcc -std=c11 RiDE_server.h RiDE_server.cpp main.cpp -o main.x -Wall -luv
everything is ok.
I think that the problem is in src/CMakeLists.txt file, but i can't understand how to fix it. Path to libuv headers on my machine - /usr/include. Path to libuv shared libs - /usr/lib/x86-64-linux-gnu.
Upvotes: 3
Views: 3811
Reputation: 249293
Run make VERBOSE=1
. What linker command does it run? It must be missing -luv
. To fix that, add something like this to your CMakeLists.txt
:
target_link_libraries(foo uv)
Upvotes: 4