News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Changing from gcc to g++

Started by Drakonaut, June 03, 2015, 06:06:34 PM

Previous topic - Next topic

Drakonaut

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!

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Drakonaut

#2
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:

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.)