undefined reference to symbol 'exp@@GLIBC_2.2.5'
Seems like the user who found the solution never shared it later. For guys who are trying to find the solution just add the math library explicitly and also add -ldl
So -lm
and -ldl
in the gcc
line you are compiling and it should go just fine.
Alternatively, in most cases you can also explicitly define CFLAGS
and alleviate the issue that way. These are just two ways of solving,
Example:
user@compiler-shell$ EXPORT CFLAGS=" -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -funroll-all-loops";
I've added -lm
into CMakeLists.txt
where libraries are being assigned. It's working now.
I found this thread with a similar problem. Explicitly, the solution is to find and change in your CMakeLists.txt file:
TARGET_LINK_LIBRARIES(lmdemo ${LIBS})
to
TARGET_LINK_LIBRARIES(lmdemo -lm ${LIBS})