Very strange linker behavior

后端 未结 8 2087
猫巷女王i
猫巷女王i 2020-12-07 17:56

This is strange because I was able to get the error below to go away by removing the reference to libm.

gcc -o example example.o -Wl -L/home/kensey/cdev/lib          


        
8条回答
  •  情书的邮戳
    2020-12-07 18:24

    Perhaps, your library search paths (/usr/local/lib/ or /usr/lib/, ...) do not contain 64bit libm so gcc cannot locate it if you specify with l flag. If you only specify only the directory it looks like it can find the right one. So you can try:

    LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

    and use -lm

提交回复
热议问题