Author Topic: Forcing g++ use  (Read 7591 times)

gregs

  • Guest
Forcing g++ use
« 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?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Forcing g++ use
« Reply #1 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?
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

gregs

  • Guest
Re: Forcing g++ use
« Reply #2 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.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Forcing g++ use
« Reply #3 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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

gregs

  • Guest
Re: Forcing g++ use
« Reply #4 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 :)