Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
arby10101
Posts: 40
Registered: ‎02-27-2011
My Device: Not Specified
Accepted Solution

Setting up qt includes in Momentics

I'm new to Momentics (used Eclipse for a while years ago) and don't understand how includes work. I'm attempting a Qt Hello World and have this

#include "qt4/QtGui/qapplication.h"

 The compiler finds that, but when parsing that file it can't find the includes specified there. For example,

 

C:/bbndk-2.1.0/target/qnx6/usr/include/qt4/QtGui/qapplication.h:45:37: error: QtCore/qcoreapplication.h: No such file or directory

 

I've tried several possibilities in Project>Properties>C++ General>Paths and Symbols>Includes but haven't succeeded in making other Qt internal paths findable.

How should I set this up?

Thanks.

Please use plain text.
Developer
oliver_kranz
Posts: 216
Registered: ‎09-18-2009
My Device: Z10

Re: Setting up qt includes in Momentics

You can just right click on your code and select Source > Add Include. Or select your code and type Ctrl + Shift + N. Both will add your include automatically. Works fine for me.

Please use plain text.
Contributor
arby10101
Posts: 40
Registered: ‎02-27-2011
My Device: Not Specified

Re: Setting up qt includes in Momentics

Thanks for your reply.

The problem is not adding the required includes for my own code but arises when trying to find the includes required by the headers I specifically reference. For example, I include qapplication.h which is in QtGui. The preprocessor opens it and tries to parse it. The first directive in that file is #include <QtCore/qcoreapplication.h> and that's the directory the preprocessor can't find.

 

I thought that adding an include path pointing to the directory qt4, which contains both QtGui and QtCore would work, but it didn't.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Setting up qt includes in Momentics

I had to add several include paths, like:

C:/bbndk-2.1.0/target/qnx6/usr/include/qt4/

C:/bbndk-2.1.0/target/qnx6/usr/include/qt4/QtGui

C:/bbndk-2.1.0/target/qnx6/usr/include/qt4/QtCore

+ whatever else you use like

C:/bbndk-2.1.0/target/qnx6/usr/include/qt4/QtNetwork etc.

Please use plain text.
Contributor
arby10101
Posts: 40
Registered: ‎02-27-2011
My Device: Not Specified

Re: Setting up qt includes in Momentics

Thanks, BGmot. I don't think I did try adding all of them. I'll try it.

Please use plain text.
Contributor
arby10101
Posts: 40
Registered: ‎02-27-2011
My Device: Not Specified

Re: Setting up qt includes in Momentics

That did the trick. Thanks again.

 

In case another Momentics newbie reads this thread, in Paths and Symbols, the list of languages on the left is not there for information. You have to select from it; GNU C is the one. (That was my first mistake when I started on this.)

 

And BGmot many, many thanks for your post "QTHelloWorld in Momentics IDE"  It was invaluable (once I found it!).

 

Ron

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Setting up qt includes in Momentics

This blog post is very old. I wouldn't use NDK to develop Qt for BB. Use Qt creator - more natural way.

Please use plain text.