Author Topic: [solved-sort of..] Change compiler for all workspace projects  (Read 3407 times)

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
[solved-sort of..] Change compiler for all workspace projects
« on: February 06, 2020, 03:45:57 pm »
Maybe I got the concept wong but currently I am stuck to select another compiler for a large workspace.

I have a large workspace with a long list of projects. The are using my default "GCC compiler". Not I want to compile them with my "GCC x64" compiler.

I do not want to reassing each single project. I also do not want to go into each single project and create new build targets with a different compiler. I can change all libs by using global vars, that works fine. The only way I can think of to change the compiler is to actually rename the compiler settings in order to "swap" them. But this is a very crude work around.

Is there a more elegant way to do that?

« Last Edit: February 07, 2020, 04:38:47 pm by tigerbeard »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Change compiler for all workspace projects
« Reply #1 on: February 06, 2020, 07:31:25 pm »
Have you tried the Plugins -> Project options manipulator tool?

If you want to have more advanced controls you'll have to use project generator like cmake.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Change compiler for all workspace projects
« Reply #2 on: February 07, 2020, 11:13:15 am »
Sadly this is not really something codeblocks supports, and this  bothers me A LOT...
The easiest way is like obfuscated mentioned: using the plugin. It should work quite straight forward, but it is not very user friendly...
Then you should probably save the project...

I "think" there is someone in the forum who uses global variables for the compiler (msvc if i remember correctly) and this probably would work to, but you would have to search the forum for his post...

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: Change compiler for all workspace projects
« Reply #3 on: February 07, 2020, 12:50:38 pm »
Have you tried the Plugins -> Project options manipulator tool?
Help on the spot. Never noticed that tool before. Thanks.
At the first look this seems to work on the cbp und workspace files directly, does it? Although there is not description in the dialog, it looks like a good way to do exotic stuff to a whole workspace that is close to impossible to do otherwise. Also it looks like you can severely destroy your workspace file if you do not know exactly what you are doing :)

Sadly this is not really something codeblocks supports, and this  bothers me A LOT...
Seems I am lucky to to have met the problem only now for the first time  :P

For my particular case I solved it now by renaming the compilers and restarted CodeBlocks. Was quick and worked fine.
Probably it only works because the original name used in the workspace was not available any more, so it assings the new default compiler to all workspace projects (but this is an assumption..).


I "think" there is someone in the forum who uses global variables for the compiler (msvc if i remember correctly) and this probably would work to, but you would have to search the forum for his post...
I never used global vars before I compiled C::B (not understooy for what they would be useful). But I can see that they can be easily used for what you say. I will try that to switch the default compiler by variable between x32 and x64. (since TDM has died the MinGW-W64 do provide only separate compilers) I had them in compiler setting "cards", but it annoyed my every time to scroll down this long list of emtpy exotic compiler shells to the very bottom to select the my other version. It would be much more elegant with global wars.

Thanks for the hint.




Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Change compiler for all workspace projects
« Reply #4 on: February 07, 2020, 03:27:30 pm »
I "think" there is someone in the forum who uses global variables for the compiler (msvc if i remember correctly) and this probably would work to, but you would have to search the forum for his post...

That's me. You can see a description of it at

https://github.com/arnholm/cpde_utils/tree/master/doc/toolchain

See the file CodeBlocks_MSVC2019_setup.pdf for details regarding MSVC, but the same idea can be applied to variants of GCC. In one sentence the idea is to define a generic compiler like "GCC compiler" (should not match predefined compiler names) and define its settings via global variables.

see also http://forums.codeblocks.org/index.php/topic,23635.msg161048.html#msg161048


« Last Edit: February 07, 2020, 03:33:25 pm by cacb »

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 186
Re: Change compiler for all workspace projects
« Reply #5 on: February 07, 2020, 04:38:14 pm »
I "think" there is someone in the forum who uses global variables for the compiler (msvc if i remember correctly) and this probably would work to, but you would have to search the forum for his post...

That's me. You can see a description of it at
Excellent documentation!
Really recommendable for everyone who want to use VC compilers properly with CodeBlocks.

Your approach confirms what I had in mind, just that with gcc I think its not as complex by far  :)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Change compiler for all workspace projects
« Reply #6 on: February 08, 2020, 07:13:26 pm »
Excellent documentation!
Really recommendable for everyone who want to use VC compilers properly with CodeBlocks.

Your approach confirms what I had in mind, just that with gcc I think its not as complex by far  :)

Thanks! I have used this method with several generations of MSVC without affecting C::B project files, and like you I have many of them. I guess the procedure described could possibly be simplified somewhat, but I use that setup with no issues now.

Yes, with gcc it should be a lot simpler.