Author Topic: Using g++  (Read 3080 times)

Offline alexchen

  • Multiple posting newcomer
  • *
  • Posts: 84
Using g++
« 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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Using g++
« Reply #1 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.