Any way to tell g++ to use another binary for compiling?
This question may sound a little absurd. F开发者_StackOverflow中文版acts:
- I have a program written in C++.
- It uses lot of in-house libs.
- I don't have read permission to the libs.
- So I have to build with a given tool which does have access to the lib headers and archives.
- Stuck on gcc 4.3
- I have a local build of gcc 4.5
- I want g++ to use my local g++ instead of the old version.
Is there any way to get this done?
Use the full path of the compiler instead of invoking it without specifying the path.
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.
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++.
精彩评论