0

这是我的 dev-cpp 编译器日志:

rm -f main.o  luaTest.exe'

gcc.exe -c main.c -o main.o -I"E:/Dev-Cpp/include"  -I"E:/Lua/5.1/include"'   
gcc.exe main.o  -o "luaTest.exe" -L"E:/Dev-Cpp/lib" -L "E:/lua/5.1/lua5.1.lib"'  

main.o(.text+0x34):main.c: undefined reference to 'luaL_newstate'

main.o(.text+0x48):main.c: undefined reference to 'luaL_openlibs'

main.o(.text+0xab):main.c: undefined reference to 'luaL_loadbuffer'

main.o(.text+0xd5):main.c: undefined reference to 'lua_pcall'

main.o(.text+0x11c):main.c: undefined reference to 'lua_tolstring'

main.o(.text+0x14e):main.c: undefined reference to 'lua_settop'

main.o(.text+0x161):main.c: undefined reference to 'lua_close'

collect2: ld returned 1 exit status'

make.exe: *** [luaTest.exe] Error 1'

我可以用 code::blocks 编译和链接我的代码成功。我无法弄清楚 dev-cpp 有什么问题。

4

2 回答 2

0

链接步骤看起来关闭。选项(大写 L)为通过(小写 L)-L引用的库设置搜索目录。-l最后一步尝试链接到lua5.1.libusing-L而不是正确的-l.

于 2011-11-18T23:48:14.410 回答
0

我发现了 dev-cpp 有什么问题。当你想链接 lib 文件时,你必须在编译器选项中关闭 makefile 生成

于 2011-11-19T03:04:44.480 回答