News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

CFLAGS vs CPPFLAGS

Started by steveth45, February 12, 2007, 11:02:28 AM

Previous topic - Next topic

steveth45

I've successfully converted Irrlicht (an open source 3D rendering engine) to a standard C::B project, not using the Makefile.  I did this so I could easily set up a debug build of the library.  It works, but there is one catch, I can't seem to configure separate options for the compilation of .c vs .cpp files.  This is done easily in the Makefile with these lines:

CXXFLAGS = -Wno-reorder // this is only used when compiling .cpp files
CFLAGS = -fexpensive-optimizations -O3 // this is only used when compiling .c files

Is there any way in a normal Code::Blocks project to differentiate compiler options for .c and .cpp files in the same project?  Right now it builds fine, but there are a bunch of warnings compiling the .c files since -Wno-reorder is not a valid option for gcc.  Also, the .cpp files shouldn't be compiled with the -O3 option in this particular project.  It seems to be introducing some subtle bugs.

TDragon

If you can find a way of separating the C and C++ sources into separate targets, you can then set the Build Options for each target individually. Beyond that, C::B doesn't yet support this functionality.
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)