Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: alexchen on July 08, 2013, 05:01:22 am

Title: Using g++
Post by: alexchen on July 08, 2013, 05:01:22 am
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
Title: Re: Using g++
Post by: Jenna on July 08, 2013, 06:54:40 am
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.