2011-11-18 145 views
0

这是我的dev-CPP编译器日志:编译链接LUA5.1 Lib。错误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' 

我可以在编译&链接我的代码的成功与代码::块。我无法弄清楚dev-cpp有什么问题。

+1

为什么你坚持使用DEV-CPP关闭生成makefile DEV-cpp.when?这是一个可怕的过时/被忽视的工具。正如你已经发现的,Code :: Blocks是无限优越的。现在删除dev-cpp。 :] – TheBuzzSaw

+0

我完全同意。甚至在标签的信息中。 – Bart

回答

0

我发现了什么不对的,你要链接库文件必须在编译器选项

0

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

+0

我已经发现dev-cpp有什么问题。当你想链接lib文件时,你必须在编译选项中关闭makefile生成.BTY -L是好的,但是必须有一个-L。 – shadow