PDA

View Full Version : Linking against different Libs



AlphaWolf
10th February 2009, 00:39
I am using Qt Creator and want to link against different libs in debug mode.

This is my .pro file:

# -------------------------------------------------
# Project created by QtCreator 2009-02-06T01:28:15
# -------------------------------------------------
TARGET = uglyviewer
TEMPLATE = app
UI_DIR = tmp
MOC_DIR = tmp
INCLUDEPATH += C:\\OgreSDK\\include
SOURCES += src/uglyviewer.cpp \
src/main.cpp \
src/ogrewidget.cpp \
src/ogremanager.cpp \
src/inputmanager.cpp
HEADERS += src/uglyviewer.h \
src/ogrewidget.h \
src/singleton.h \
src/ogremanager.h \
src/inputmanager.h
FORMS += ui/uglyviewer.ui
RESOURCES += res/resource.qrc
RC_FILE = res/app.rc
debug {
OBJECTS_DIR = tmp/debug/
RCC_DIR = tmp/debug/
LIBS = -L%OGRE_HOME%\bin\debug -lOIS_d -lOgreMain_d
}
release {
OBJECTS_DIR = tmp/release/
RCC_DIR = tmp/release/
LIBS = -L%OGRE_HOME%\bin\release -lOIS -lOgreMain
}


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.

nightghost
10th February 2009, 08:49
Use

CONFIG -= debug_and_release
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

jpn
10th February 2009, 13:20
CONFIG(debug, debug|release) {
OBJECTS_DIR = tmp/debug/
RCC_DIR = tmp/debug/
LIBS = -L%OGRE_HOME%\bin\debug -lOIS_d -lOgreMain_d
} else {
OBJECTS_DIR = tmp/release/
RCC_DIR = tmp/release/
LIBS = -L%OGRE_HOME%\bin\release -lOIS -lOgreMain
}

AlphaWolf
10th February 2009, 15:25
Thank you guys! jpns snipped worked:D

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:


CONFIG(debug, debug|release) {
OBJECTS_DIR = tmp/debug/
RCC_DIR = tmp/debug/
LIBS = -L%OGRE_HOME%\bin\debug -lOIS_d -lOgreMain_d
DESTDIR=bin/system_d
} else {
OBJECTS_DIR = tmp/release/
RCC_DIR = tmp/release/
LIBS = -L%OGRE_HOME%\bin\release -lOIS -lOgreMain
DESTDIR=bin/system
}