Question

I have been working in Visual Studio on a project and had a header file which I included in every other header file using Project Properties -> C/C++ -> Advanced -> Forced Include File. How do I do this in Code Blocks?

Was it helpful?

Solution

Code::Blocks uses the g++ compiler by default.

With g++ the option to force a header inclusion is -include file, which you just put in the IDE settings (e.g. right click project, select build options, IIRC).

To find that information I just googled "forced include g++", which landed me at (http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html), the relevant documentation.

It's often a good idea to consult the documentation, and if that fails, google.

Or as in this case, the opposite order, but anyway, that's a good idea.

OTHER TIPS

Personally I'd use perl to include the header file in question, e.g., after the first header file in a given file and would run the perl script on all .cpp files, probably using find. Put differently: I would change all .cpp files but not manually (unless there are just a few files involved).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top