Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to set clang++ as the system C++ compiler on Fedora 18. I have installed clang and added it to alternatives but it doesn't appear to be working.

[user@localhost ~]$ alternatives --display c++
c++ - status is auto.
 link currently points to /usr/bin/clang++
/usr/bin/clang++ - priority 1
Current `best' version is /usr/bin/clang++.
[user@localhost ~]$ c++ --version
c++ (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

c++ still appears to be using gcc even though alternatives is configured to use clang++.


type -a c++ output:

[user@localhost ~]$ type -a c++
c++ is /usr/bin/c++
c++ is /bin/c++
share|improve this question
2  
What does type -a c++ say? –  jordanm Apr 1 '13 at 19:37
    
Added type -a c++ output to question. –  Jephir Apr 1 '13 at 19:42
add comment

1 Answer

I think that alternatives are the wrong approach here. More specifically, I think changing the system default is really the wrong approach. Rather than changing things at that level, I suggest

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++

Unless something goes out of its way to break it, this will work with almost all make systems.

If you want this to be the default systemwide, you could put this in the system bash startup scripts in /etc/.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.