Jump to content

Using QtCreator as C++ IDE (Linux)


Recommended Posts

This post provides informations on the steps for creating a C++ project with UNIGINE and using QtCreator as IDE on Linux platform.
We suppose that QtCreator and Unigine SDK are already installed as well as GCC compiler and CMake.
QtCreator is a cross-platform IDE so same process can be achieved on Windows using the VS compiler or GCC for Windows.

my current system :

LinuxMint 19.0
GCC 7.4.0
CMake 3.10.2 (note that CMake 3.14 or higher is required by default but I can get it work with 3.10, see below)
Qt SDK 5.11.2
Unigine 2 Community : SDK 2.11.01

 

1. Run Unigine SDK browser an create a new project  1.thumb.png.888d3ed85b63fc54c710eca4f54c2803.png
Set a project name : my_unigine_project
Select API + IDE : C++ (CMake)
And click "Create New Project"

 

2. Customize code editor

On Unigine browser, click "..." button under "Open Code IDE" 2.thumb.png.4a2e2a7ce1500fdb40e9d66c480337fa.png
Editor : Custom
Binary : /opt/Qt5.11.2/Tools/QtCreator/bin/qtcreator (path where QtCreator is installed on your system)
Argument : CMakeLists.txt
And click Open (it will open QtCreator)

 

3. Configure QtCreator
3.thumb.png.dd3ae5420c9a4aee43085ec8db2210c7.png
Select Desktop GCC 64 bits kit and click "Configure Project"

 

4. Edit CMake file (optionnal)

This step is only required if you have a CMake version lower than 3.14, because you will get this error:
4.thumb.png.c84f154f0cd1e2872c8bee1895c9afff.png
Just change the first line :
cmake_minimum_required(VERSION 3.14)
with
cmake_minimum_required(VERSION 3.10)
Save and go to Menu / Compile / Run CMake
C++ Project is now loaded.

 

5. Setup Build and Run project

Go to Projects / Build and Run
Select Build panel and select your build configuration (Debug/Release/..)
5.thumb.png.bbbe693bb3d1c4a15d39fd3a95e2e8a9.png

 

In order to run Unigine project from QtCreator you need to edit Run parameters with Unigine arguments.
Select Run Panel and set the "Command line arguments" :6.thumb.png.a95ea1ddf5f6d2b34d917ecc8a9e3499.png

-data_path ../ -engine_config unigine.cfg -console_command "world_load \"my_unigine_project\""

See Unigine documentation for command line informations.

 

6. Run project

You can now edit and compile your code as usual in QtCreator.

Run your project by clicking the big green triangle in QtCreator or Ctrl+r shortcut.

7.thumb.png.017bb9e099e92ceb93dadcdcd9fa10d8.png

Great. Thanks Unigine.

 

 

Edited by fred.akilla
  • Like 8
Link to comment
×
×
  • Create New...