Results 1 to 4 of 4

Thread: Linking against different Libs

  1. #1
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Linking against different Libs

    I am using Qt Creator and want to link against different libs in debug mode.

    This is my .pro file:
    Qt Code:
    1. # -------------------------------------------------
    2. # Project created by QtCreator 2009-02-06T01:28:15
    3. # -------------------------------------------------
    4. TARGET = uglyviewer
    5. TEMPLATE = app
    6. UI_DIR = tmp
    7. MOC_DIR = tmp
    8. INCLUDEPATH += C:\\OgreSDK\\include
    9. SOURCES += src/uglyviewer.cpp \
    10. src/main.cpp \
    11. src/ogrewidget.cpp \
    12. src/ogremanager.cpp \
    13. src/inputmanager.cpp
    14. HEADERS += src/uglyviewer.h \
    15. src/ogrewidget.h \
    16. src/singleton.h \
    17. src/ogremanager.h \
    18. src/inputmanager.h
    19. FORMS += ui/uglyviewer.ui
    20. RESOURCES += res/resource.qrc
    21. RC_FILE = res/app.rc
    22. debug {
    23. OBJECTS_DIR = tmp/debug/
    24. RCC_DIR = tmp/debug/
    25. LIBS = -L%OGRE_HOME%\bin\debug -lOIS_d -lOgreMain_d
    26. }
    27. release {
    28. OBJECTS_DIR = tmp/release/
    29. RCC_DIR = tmp/release/
    30. LIBS = -L%OGRE_HOME%\bin\release -lOIS -lOgreMain
    31. }
    To copy to clipboard, switch view to plain text mode 

    The problem is that release overwrites debug because the Qt Creator always adds an debug_and_release to the CONFIG and therefore both debug and release are always definded.

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Linking against different Libs

    Use
    Qt Code:
    1. CONFIG -= debug_and_release
    To copy to clipboard, switch view to plain text mode 
    to remove debug_and_release from the configuration (I dont know if this works with Creator, but thats the normal way to remove configuration entries)

    or define 2 targets. one for debug and one for release

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Linking against different Libs

    qmake Code:
    1. CONFIG(debug, debug|release) {
    2. OBJECTS_DIR = tmp/debug/
    3. RCC_DIR = tmp/debug/
    4. LIBS = -L%OGRE_HOME%\bin\debug -lOIS_d -lOgreMain_d
    5. } else {
    6. OBJECTS_DIR = tmp/release/
    7. RCC_DIR = tmp/release/
    8. LIBS = -L%OGRE_HOME%\bin\release -lOIS -lOgreMain
    9. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  4. #4
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linking against different Libs

    Thank you guys! jpns snipped worked

    Edit: I wanted so save my executables to annother dir. the problem now ist that the Creator always start the binary inside the system folder even if I selected Debug as build mode:

    Qt Code:
    1. CONFIG(debug, debug|release) {
    2. OBJECTS_DIR = tmp/debug/
    3. RCC_DIR = tmp/debug/
    4. LIBS = -L%OGRE_HOME%\bin\debug -lOIS_d -lOgreMain_d
    5. DESTDIR=bin/system_d
    6. } else {
    7. OBJECTS_DIR = tmp/release/
    8. RCC_DIR = tmp/release/
    9. LIBS = -L%OGRE_HOME%\bin\release -lOIS -lOgreMain
    10. DESTDIR=bin/system
    11. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by AlphaWolf; 10th February 2009 at 15:40.

Similar Threads

  1. Linking
    By ^NyAw^ in forum General Programming
    Replies: 7
    Last Post: 30th October 2008, 17:37
  2. problem with order of libs during linking
    By minimax in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2008, 10:32
  3. Bad relink libs on QT4 Mac OSX (install_name_tool)
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2007, 09:01
  4. linking libraries
    By JustaStudent in forum Newbie
    Replies: 29
    Last Post: 2nd May 2006, 08:30
  5. Replies: 4
    Last Post: 20th February 2006, 09:11

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.