Using QT Creator

From OpenCog
Jump to: navigation, search


This page describes how to set up a project in QT Creator. Its graphics have become slightly updated; the text reflects some important changes.


Start QT Creator using either the shortcut in the Ubuntu menu on the left side of the screen or by searching for it in Dash Home. You should see a startup screen as shown below:

Create QT Project for Opencog - 0.png

Click the 'Open Project' button near the bottom of the dialog box and you will see a standard file/folder browsing dialog.

Navigate to the directory you downloaded the OpenCog source files to and select and open the CMakeLists.txt file. QT can use this file to locate all the files that are part of the project and will create a CMakeLists.txt.user file next to it to store it's own extra information. This new file will not be pushed by git, as it is excluded by our .gitignore (yay!)

Create QT Project for Opencog - 1.png

QT will then ask you for a build location. I currently recommend that if one selects to build within the OpenCog file hierarchy, that one gives the new project directory a name containing the substring '-build-' such as 'qtcreator-build-newbranch'

Our .gitignore file will then exclude this directory from being pushed/pulled- and THAT is desirable. Unlike in the photo, both '-' dash marks are necessary.

Create QT Project for Opencog - 2.png

Click 'Next' to move to the next screen called 'Run CMake'. Add ".." to Arguments. Click on the 'Run CMake' button to have QT call the CMake command. The output may be in a red font, but if you've followed the steps properly all should be fine.

Note: If QT does not show this screen, at the time of writing it can be accessed by clicking on 'Projects' in QT's left-hand navigation bar and adding .. under CMake arguments. This step mimics the cmake .. command we would ordinarily use to build OpenCog, and builds into the qt build folder instead of the usual OpenCog build folder.)

Create QT Project for Opencog - 5.png

Click 'Finish' and you should be returned to the main QT window, with the folder structure of OpenCog showing on the left side.

Create QT Project for Opencog - 6.png

You can now click the hammer button all the way in the bottom left of the QT screen to start the build process.

If you want to build on multiple cores/threads you can click on the 'Project' icon in the left menu bar to open the Project file view. Here you can click the 'Details' button under Build Steps to expand the box. Enter -j followed by the maximum number of concurrent threads you would like to run. Don't make this too high or your system will lock up until it has finished.

Create QT Project for Opencog - 7.png

All done! You can now build the OpenCog source in QT!

Next Steps

Now that you have a project in QT to work with, you have several options. You could: