How to change the default GCC compiler in Ubuntu?

后端 未结 8 1386
孤街浪徒
孤街浪徒 2020-11-28 17:44

I have installed gcc-3.3/g++-3.3 on ubuntu 11.04 which already has gcc/g++-4.4. So in my system both gcc-3.3 and 4.4 are available. I am able to call both compilers as I wan

8条回答
  •  北海茫月
    2020-11-28 18:36

    I found this problem while trying to install a new clang compiler. Turns out that both the Debian and the LLVM maintainers agree that the alternatives system should be used for alternatives, NOT for versioning.

    The solution they propose is something like this:
    PATH=/usr/lib/llvm-3.7/bin:$PATH
    where /usr/lib/llvm-3.7/bin is a directory that got created by the llvm-3.7 package, and which contains all the tools with their non-suffixed names. With that, llvm-config (version 3.7) appears with its plain name in your PATH. No need to muck around with symlinks, nor to call the llvm-config-3.7 that got installed in /usr/bin.

    Also, check for a package named llvm-defaults (or gcc-defaults), which might offer other way to do this (I didn't use it).

提交回复
热议问题