Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: gregs on February 22, 2007, 12:49:37 am

Title: Forcing g++ use
Post by: gregs on February 22, 2007, 12:49:37 am
Is there a way of forcing codeblocks to use g++ as opposed to gcc for C files?
Title: Re: Forcing g++ use
Post by: TDragon on February 22, 2007, 12:56:55 am
Yes: Settings->Compiler and debugger->Global compiler settings->Toolchain executables.
But why exactly would you want to do that?
Title: Re: Forcing g++ use
Post by: gregs on February 22, 2007, 03:10:12 am
For some reason one of my libraries isn't producing the right symbols (even with extern "C") to allow it to be linked to the rest of my projects. This only seems to be a problem with gcc, as the other platforms compile happily, but they're using C++ compilers only. As it is, I'm trying to find the reason, and one of those may be incorrect namemangling, which compiling through g++ might help.
Title: Re: Forcing g++ use
Post by: TDragon on February 22, 2007, 04:01:13 am
Even when you invoke g++ rather than gcc, the C compiler will still be used on files ending in .c. To force it to treat all files as C++, add the option "-x c++" -- but I doubt this is the correct fix for your problem, since GCC is able to link C symbols into C++ programs.
Title: Re: Forcing g++ use
Post by: gregs on February 22, 2007, 06:40:55 pm
I agree. I found the problem, and it was just something unbelieveably simple and completely unrelated (as these things tend to be). Thank you very much for your help, especially as I didn't know the "-x c++" switch before :)