Setting Up An Application With QtCreator |
Introduction
This set of instructions will walk you through setting up a QtCreator C++ project from scratch.
When you have finished this tutorial you will be able to compile a working Ogre Application and you will be ready to start the Basic Tutorials.
Table of contents
Prerequisites
Get QtCreator from qt-project.org.
Get the stable version that fits your setup.
New Project
Click New Project in the start screen, and choose Other Project - Empty project.
Give it a name and a place:
Add files: (Tip: Move your cpp and h-files to inside the Qt project folder before you do this!)
Files added:
Options:
Qt4 Settings: (Tip: In Qt 5 this is called "Build & Run". If you have installed Visual Studio before you installed the Visual Studio Qt 5-version, all this should already be correct set up., so you do not have to do anything here.)
Edit project file:
TEMPLATE = app TARGET = OgreQtProject DEFINES -= UNICODE CONFIG -= qt unix { # You may need to change this include directory INCLUDEPATH += /usr/include/OGRE CONFIG += link_pkgconfig PKGCONFIG += OGRE } win32 { LIBS *= user32.lib LIBS += -L$(OGRE_HOME)\\boost\\lib release:LIBS += -L$(OGRE_HOME)\\lib\\release debug:LIBS += -L$(OGRE_HOME)\\lib\\debug INCLUDEPATH += $(OGRE_HOME)\\include INCLUDEPATH += $(OGRE_HOME)\\include\\OIS INCLUDEPATH += $(OGRE_HOME)\\include\\OGRE INCLUDEPATH += $(OGRE_HOME)\\boost # If you are using Ogre 1.9 also include the following line: # INCLUDEPATH += $(OGRE_HOME)\\include\\OGRE\\Overlay } debug { TARGET = $$join(TARGET,,,d) LIBS *= -lOgreMain_d -lOIS_d # If you are using Ogre 1.9 also include -lOgreOverlay_d, like this: # LIBS *= -lOgreMain_d -lOIS_d -lOgreOverlay_d } release { LIBS *= -lOgreMain -lOIS # If you are using Ogre 1.9 also include -lOgreOverlay, like this: # LIBS *= -lOgreMain -lOIS -lOgreOverlay } HEADERS += \ TutorialApplication.h \ BaseApplication.h SOURCES += \ TutorialApplication.cpp \ BaseApplication.cpp
Build All:
Build Settings:
Note: In the Release configuration, go to
"Build Steps -> qmake", press "Details" and add
"CONFIG-=debug" "CONFIG+=release"
to the "Additional arguments:"
Then to this:
Custom Process Step settings: - do this for both the Debug and Release configuration:
Note: You can also use environment variables here, in %-signs. Like this:
C:\Windows\System32\cmd.exe /c copy debug\OgreQtProjectd.exe %OGRE_HOME%\bin\debug
and you probably want to leave the Working directory to the defaul value of %{buildDir}.
Run Settings - must make one for debug, one for release:
New Run Configuration:
Note: You can also use environment variables here, in %-signs. Like this:
Executable: OgreQtProjectd.exe Working directory: %OGRE_HOME%\bin\debug
Tutorial Framework
Tutorial Framework:
Download the Ogre Wiki Tutorial Framework here:
Project Configuration