Importing LUA into Qt Creator project on Windows linking problem
Hi to all!
I am trying to compile qt 4.7.0 app that integrades LUA scripting language in Qt Creator 2.0.1 under Windows 7 Ultimate. At compile time, I get following errors:
Quote:
debug/mainwindow.o:C:\Users\HP2\Desktop\ABTeamTestApp-build-desktop/../ABTeamTestAppWC/mainwindow.cpp:32: undefined reference to `luaL_newstate' debug/mainwindow.o:C:\Users\HP2\Desktop\ABTeamTestApp-build-desktop/../ABTeamTestAppWC/mainwindow.cpp:35: undefined reference to `luaL_openlibs'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\ABTeamTestApp.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project ABTeamTestApp (target: Desktop)
When executing build step 'Make'
When executing build step 'Make'.
Now, the reason for error is following method:
Code:
void MainWindow::initLUA()
{
lua_State* L=lua_open();
if(!L)
qFatal("LUA cannot be initialized.");
luaL_openlibs(L);
}
I am checking my .pro file (for including dlls and libs)
and I am getting nowhere. Here is .pro file:
Code:
#-------------------------------------------------
#
# Project created by QtCreator 2011-02-10T10:21:14
#
#-------------------------------------------------
QT += core gui
TARGET = ABTeamTestApp
TEMPLATE = app
CONFIG += ordered
SOURCES += main.cpp\
mainwindow.cpp \
centralwidget.cpp \
HEADERS += mainwindow.h \
centralwidget.h \
lua/include/lualib.h \
lua/include/luaconf.h \
lua/include/lua.hpp \
lua/include/lua.h \
lua/include/lauxlib.h
win32:LIBS += \
-L"lua/lib/lua5.1.lib" \
-L"lua/lib/lua51.lib" \
-L"lua/lib/lua5.1.dll" \
-L"lua/lib/lua51.dll"
Can someone help me with problem?
Sincerely,
Marko
Re: Importing LUA into Qt Creator project on Windows linking problem
Code:
win32:LIBS += \
-L"lua/lib/lua5.1.lib" \
-L"lua/lib/lua51.lib" \
-L"lua/lib/lua5.1.dll" \
-L"lua/lib/lua51.dll"
Use '-L' switch to define a directory to search for libraries, you need to use '-l' if you want to link a library.
And whats the point in dynamic and static linking at the same time ?
Use .dlls or .libs ( you link to .dll with -l )
Code:
win32:LIBS += \
-L"lua/lib" \
-llua5.1
or
[CODE]
Code:
win32:LIBS += "lua/lib/lua5.1.lib"
Re: Importing LUA into Qt Creator project on Windows linking problem
Thanks! It compiles now! I am little tired and I did not see it :D
Added after 51 minutes:
Well, now I have same god damn problem under Mac OS X, how do I redefine LIBS section for mac?