tags:

views:

84

answers:

2

In Eclipse there is an option to specify pre processing defines (#ifdef macros) to a project by using the Symbols option in Paths and Symbols. This helps in effective indexing of code which is cross platform. Is there any option to provide these in Qt creator?

+1  A: 

You can define some PREPROCESSOR in the Project settings in QtCreator. I do not have QtCreator here but i remember there is a tab for project configuration.

Patrice Bernassola
I couldn't find such setting in the Project Configuration.
Bharathwaaj
The Tab name is "Projects", You can custom compilation here by adding your preprocessor define
Patrice Bernassola
I don't use qt creator for compilation. I use it for indexing.
Bharathwaaj
You can add preprocessor in compiler parameters using the \d option. Example: g++ -D NAME[=Value]
Patrice Bernassola
This won't work. I don't use qt creator for compilation. I use it for indexing. Looks like qt creator doesn't have that functionality to statically interpret code.
Bharathwaaj
Compiler option are not a feature of QtCreator but a compiler one. Even if you are not using QtCreator for compiling your code, you can define PREPROCESSOR with the -D option and use them in your code in QtCreator.
Patrice Bernassola
A: 

It depends:-)

The following is assuming you are using qmake based projects:

First you can add "DEFINES += SOME_DEFINE=value" into your .pro file. That is picked up inside creator and when building on the command line and should also show up when creating a MSVC or XCode project from the .pro file.

Then you can add "DEFINES+=SOME_DEFINE=value" to the qmake call that Qt Creator will issue when configuring the project. That happens in the Project Mode, Build Settings, QMake Steps.

Finally you can put #define SOME_DEFINE value liens into a header file an include that. That works for all kinds of projects:-)

Tobias Hunger
No I don't use qtcreator for building. I wan't it only for its powerful indexing.
Bharathwaaj
And my project is not qmake based.
Bharathwaaj