This is strange because I was able to get the error below to get away by deleting the libm link.
gcc -o example example.o -Wl -L/home/kensey/cdev/lib -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -L/usr/lib/x86_64-linux-gnu -lm -lrt -ldl -lcdev -L/home/kensey/www.tools/gplot-lib -lgplot -L/home/kensey/www.tools/gd1_3ret -lgd -lxml2 -lcurl /usr/bin/ld: /home/kensey/www.tools/gplot-lib/libgplot.a(set.o): undefined reference to symbol 'floor@@GLIBC_2.2.5' /usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined in DSO /usr/lib/x86_64-linux-gnu/libm.so so try adding it to the linker command line /usr/lib/x86_64-linux-gnu/libm.so: could not read symbols: Invalid operation collect2: ld returned 1 exit status
So, if I remove the -lm part of the command, I will not get an error. However, I am wondering if anyone knows why removing the link to the desired library will fix this. How does the linker know which library to look for? Also, is there a way to request the embedded executable and say: βIn which library did you decide to link toβ gender β? Obviously, something is happening, I donβt understand, and it bothers me ...
gcc linker ld
Don Wool Mar 29 2018-12-12T00: 00Z
source share