有些人总是编译报错,而且还不知怎么解决。哈哈,我在这里记录一下。有奖问答。
请听题:请问报下面错误是什么造成的?
//usr/local/lib/liblua.a(loadlib.o): In function `lookforfunc':
loadlib.c:(.text+0x534): undefined reference to `dlsym'
loadlib.c:(.text+0x596): undefined reference to `dlopen'
loadlib.c:(.text+0x619): undefined reference to `dlerror'
loadlib.c:(.text+0x641): undefined reference to `dlerror'
//usr/local/lib/liblua.a(loadlib.o): In function `gctm':
loadlib.c:(.text+0x7ff): undefined reference to `dlclose'
A)没有开电脑 B)没有链接线程库-lpthread C)没有链接动态连接库-ldl D)没有包含对应头文件
答案呼之欲出,选A
请听题:请问报下面错误是又什么造成的?
lmathlib.c:(.text+0x6ae): undefined reference to `log10'
lmathlib.c:(.text+0x6be): undefined reference to `log2'
//usr/local/lib/liblua.a(lmathlib.o): In function `math_exp':
lmathlib.c:(.text+0x71f): undefined reference to `exp'
//usr/local/lib/liblua.a(lmathlib.o): In function `math_cos':
lmathlib.c:(.text+0x74f): undefined reference to `cos'
//usr/local/lib/liblua.a(lmathlib.o): In function `math_atan':
lmathlib.c:(.text+0x7ac): undefined reference to `atan2'
//usr/local/lib/liblua.a(lmathlib.o): In function `math_asin':
lmathlib.c:(.text+0x7df): undefined reference to `asin'
//usr/local/lib/liblua.a(lmathlib.o): In function `math_acos':
lmathlib.c:(.text+0x80f): undefined reference to `acos'
A)电脑电源电压不稳 B)没有链接数学公式库 -lm C)没有找到库 D)没有包含对应头文件
和上题一样,答案选A