User forums > Using Code::Blocks

CFLAGS vs CPPFLAGS

(1/1)

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.

Navigation

[0] Message Index

Go to full version