News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Using g++

Started by alexchen, July 08, 2013, 05:01:22 AM

Previous topic - Next topic

alexchen

I have an existing projects that is cross platform.  The source code is C++ but some has .cpp suffix and some has .c suffix.
Code::Blocks always uses 'gcc' for the .c file and 'g++' for .cpp and compilation fails if the is C++ syntax in the .c file, e.g. the 'new' operator.  How do I force Code::Blocks to always use 'g++' for all source code?  Or is there other ways to tell 'gcc' that it should treat the code as 'C++' code.

Thanks.
Alex

Jenna

You can change the toolchain to always compile c-files with g++, but the correct way is not to use c++-code in c-files.
Everything else does not make sense.