开发者

Any way to tell g++ to use another binary for compiling?

开发者 https://www.devze.com 2023-02-10 12:42 出处:网络
This question may sound a little absurd. F开发者_StackOverflow中文版acts: I have a program written in C++.

This question may sound a little absurd. F开发者_StackOverflow中文版acts:

  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?


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++.

0

精彩评论

暂无评论...
验证码 换一张
取 消