Author Topic: Changing from gcc to g++  (Read 2428 times)

Offline Drakonaut

  • Single posting newcomer
  • *
  • Posts: 4
Changing from gcc to g++
« on: June 03, 2015, 06:06:34 pm »
Hello. I'm facing a compiler problem here. I've a code in C++ but the compiler refuses to compile with g++ and keeps coming up with errors. Is there any way that I can change that? I'm using Code::Blocks 13.12

The toolchain exe (for the C++ tab) has this "mingw32-g++.exe", but I don't understand why it doesn't use that. My files are saved under the .cpp extension too. I tried my code with other compilers and it has no errors, so I thought it might be C::B settings.

I prefer C::B over others though  ;D

Thanks!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Drakonaut

  • Single posting newcomer
  • *
  • Posts: 4
Re: Changing from gcc to g++
« Reply #2 on: June 03, 2015, 09:09:17 pm »
I am running Code::Blocks version Code::Blocks 13.12 on Windows 7 HP
(version OperatingSystemVersionNumber). The compiler I use is TDM-GCC
version 4.7.1.

Description of problem.
My .cpp files fail to compile. When I google the errors, it seems that the program uses C compiler. In the build log it also uses the C compiler. I saved all my files as .cpp but to no avail. I went to check my compiler .exe for g++ and it is there (mingw32-g++.exe).

Build log:
Code
mingw32-gcc.exe -Wall -fexceptions -g  -c "C:\Users\Benedict\Desktop\Chapter 9 Ex1\C9E4\namespace.h" -o namespace.h.gch
C:\Users\Drakonaut\Desktop\Chapter 9 Ex1\C9E4\namespace.h:4:1: error: unknown type name 'namespace'
C:\Users\Drakonaut\Desktop\Chapter 9 Ex1\C9E4\namespace.h:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token

   
I have already tried googling for answers but none seemed to work (Maybe I'm not trying hard enough or am missing some keywords).

EDIT: Nvm, I've found a way to do it (Changing the CC to CPP in the properties file.)
« Last Edit: June 03, 2015, 09:13:48 pm by Drakonaut »