我正在尝试编译一个依赖于 liblua51.so 的共享库(so)的简单示例程序。我的源文件是 example.c,这是我用来编译它的命令(它是用 C 编写的)
cc -Wall -fPIC -ldl -o a.out -I./ste-linux/ste-interface-files/c/ -L./ste-linux/ste-shared-libraries/ example.c -lm -llua51 -lste -lm -ldl
我收到以下错误:
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `sinh'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `ceil'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `atan2'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `tanh'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `cosh'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `fmod'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `acos'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `sin'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `atan'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `asin'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `exp'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `tan'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `cos'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `log'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `pow'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `log10'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `sqrt'
./ste-linux/ste-shared-libraries//liblua51.so: undefined reference to `floor'
我在 stackoverflow 上阅读了一堆其他线程,说添加 -lm 标志可以解决这个问题,但是无论我将 -L 和 -lm -ldl 放在命令中的哪个位置,这些未定义的引用都不会消失。
我正在尝试在 ubuntu 12.04 LTS 上编译这个库
请帮忙