User forums > Using Code::Blocks

switching between different versions of GCC when using custom Makefile

(1/1)

von.hake:
Hi!

I have two different versions of GCC installed on my Debian Linux.

I just noticed that when I run the Makefile from inside Code::Blocks, other version of GCC is being used than when I run the same Makefile from the terminal.
Normally I switch between the GCC versions by specifying PATH and LD_LIBRARY_PATH variables in .bashrc.
But how do I change the version of the compiler when running the custom Makefile from Code-Blocks?

oBFusCATed:
You can probably use the envvar plugin to specify the PATH/LD_LIBRARY_PATH variables.

von.hake:
Thanks for the suggestion. I played with envvar plugin and figured out that it really matters. For some reason however I get the PATH variable modified somehow else.
So, basically, I set PATH in envvar as
--- Code: ---/opt/zombo:/opt/gcc-4.4.3/bin:$PATH
--- End code ---

then in Makefile after echo $(PATH) I get

--- Code: ---/opt/gcc-4.2.1/bin:/opt/zombo:/opt/gcc-4.4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
--- End code ---

Thus I assume someone really wants to use gcc 4.2.1.
Could anyone explain this?

Jenna:
I guees the compiler you have set for your project (most likely default compiler) has /opt/gcc-4.2.1 as masterpath.
If the project/target is build, the masterpath with a trailing bin will prepended to the existing path.

We don't need this for custom makefile projects, because the makefiles normally setup the compiler themselves.

I will see if it is easy to change this behaviour for custom makefile projects.

von.hake:
Thanks for the explanation, Jens.
I resolved the issue by changing GCC's Compiler's installation directory in Settings->Compiler&Debugger->Global compiler settings->Toolchain executables.

Navigation

[0] Message Index

Go to full version