0

This question may sound a little absurd. Facts:

  1. I have a program written in C++.
  2. It uses lot of in-house libs.
  3. I don't have read permission to the libs.
  4. So I have to build with a given tool which does have access to the lib headers and archives.
  5. Stuck on gcc 4.3
  6. I have a local build of gcc 4.5
  7. I want g++ to use my local g++ instead of the old version.

Is there any way to get this done?

nakiya
  • 14,063
  • 21
  • 79
  • 118
  • Do you call the local build by the path, or just type `g++`? – Mikhail Feb 11 '11 at 16:50
  • I just call it via a script. And the builder runs under a different user. Therefor, I can't do anything by changing my environment variables. – nakiya Feb 11 '11 at 17:43

3 Answers3

0

Use the full path of the compiler instead of invoking it without specifying the path.

Andrea Spadaccini
  • 12,378
  • 5
  • 40
  • 54
  • You can also edit your .bashrc and put something like export PATH=/home/usr/gcc4.5:$PATH so that you always default to this compiler path. – Grammin Feb 11 '11 at 16:57
0

Many configure scripts accept the CC environment variable:

export CC=/usr/bin/gcc44 for example. If you have a configure script, try ./configure --help to see if it's supported.

Daniel Stelter
  • 466
  • 3
  • 6
0

Assuming you have g++ in your ~/bin folder, could you add

export PATH=~/bin:$PATH

to your shell's .profile file (.bash_profile for bash). Then when you log in again and do which g++ it should show your local version of g++.

Abe Voelker
  • 30,124
  • 14
  • 81
  • 98