LD_LIBRARY_PATH doesn't seem to work

前端 未结 3 820
广开言路
广开言路 2021-02-05 17:08

I\'m trying to compile a test file:

gcc -o test  test.c -lg2c

but I get the error:

/usr/bin/ld: cannot find -lg2c
3条回答
  •  遥遥无期
    2021-02-05 17:42

    Make sure that you export LD_LIBRARY_PATH after modifying it. Otherwise GCC won't be able to see the modified version.

    LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/3.4.6:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    gcc -o test test.c -lg2c
    

提交回复
热议问题