Results 1 to 3 of 3

Thread: Importing LUA into Qt Creator project on Windows linking problem

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default 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:
    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:
    Qt Code:
    1. void MainWindow::initLUA()
    2.  
    3. {
    4.  
    5. lua_State* L=lua_open();
    6.  
    7. if(!L)
    8.  
    9. qFatal("LUA cannot be initialized.");
    10.  
    11. luaL_openlibs(L);
    12.  
    13. }
    To copy to clipboard, switch view to plain text mode 
    I am checking my .pro file (for including dlls and libs)
    and I am getting nowhere. Here is .pro file:
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2011-02-10T10:21:14
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. TARGET = ABTeamTestApp
    10. TEMPLATE = app
    11. CONFIG += ordered
    12.  
    13. SOURCES += main.cpp\
    14. mainwindow.cpp \
    15. centralwidget.cpp \
    16.  
    17. HEADERS += mainwindow.h \
    18. centralwidget.h \
    19. lua/include/lualib.h \
    20. lua/include/luaconf.h \
    21. lua/include/lua.hpp \
    22. lua/include/lua.h \
    23. lua/include/lauxlib.h
    24.  
    25. win32:LIBS += \
    26. -L"lua/lib/lua5.1.lib" \
    27. -L"lua/lib/lua51.lib" \
    28. -L"lua/lib/lua5.1.dll" \
    29. -L"lua/lib/lua51.dll"
    To copy to clipboard, switch view to plain text mode 
    Can someone help me with problem?

    Sincerely,
    Marko
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Importing LUA into Qt Creator project on Windows linking problem

    Qt Code:
    1. win32:LIBS += \
    2. -L"lua/lib/lua5.1.lib" \
    3. -L"lua/lib/lua51.lib" \
    4. -L"lua/lib/lua5.1.dll" \
    5. -L"lua/lib/lua51.dll"
    To copy to clipboard, switch view to plain text mode 
    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 )
    Qt Code:
    1. win32:LIBS += \
    2. -L"lua/lib" \
    3. -llua5.1
    To copy to clipboard, switch view to plain text mode 
    or
    [CODE]
    Qt Code:
    1. win32:LIBS += "lua/lib/lua5.1.lib"
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default 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


    Added after 51 minutes:


    Well, now I have same god damn problem under Mac OS X, how do I redefine LIBS section for mac?
    Last edited by MarkoSan; 10th February 2011 at 17:03.
    Qt 5.3 Opensource & Creator 3.1.2

Similar Threads

  1. Replies: 3
    Last Post: 1st December 2010, 12:24
  2. Qt Creator - problem loading project
    By Ferric in forum Newbie
    Replies: 1
    Last Post: 7th January 2010, 23:25
  3. Replies: 2
    Last Post: 26th November 2009, 00:44
  4. importing creator project into eclipse
    By piotr.dobrogost in forum Qt Tools
    Replies: 3
    Last Post: 1st June 2009, 01:14
  5. Importing qt project to an eclipse workspace
    By isahin in forum Installation and Deployment
    Replies: 2
    Last Post: 28th January 2008, 19:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.