Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am an unskilled Ubuntu user and almost each time I try to install something nontrivial I break something miserably. I am successfully using gcc 4.7 and 4.8 simultaneously using update-alternatives according to this answer. Now I would like to try out clang for my C++ development.

I am afraid that the complier is a critical part of the operating system and installing it is nontrivial. I am afraid that if install clang it will overwrite the C++ standard headers and libraries of gcc and/or break something else.

How can I safely install and use clang and gcc?

EDIT:

I do not have aptitude installed, so I tried:

sudo apt-get install clang-3.4

instead and everything looks fine. I tested gcc and it seems that I did not break it.

Then I tried to compile something with clang and I got this error:

/usr/include/c++/4.8/iostream:38: error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^

It seems that clang is trying to use the gcc standard library. How can I solve this?

share|improve this question
    
your edit basically changes the question you asked. mark this one as resolved and open another one. likely on a different site. –  myusuf3 Feb 5 at 15:38
add comment

1 Answer 1

up vote 1 down vote accepted

You are likely compiling everything yourself. if you are 'unskilled' (I don't think so, just new) ubuntu user I would highly suggest the deb maintainers do the hard work for you.

so check to see if apt-get has a copy which you want to use by searching like so.

aptitude search clang

if it does great it will handle things, if not you can download tar ball here

Extact it to /usr/local or /opt from there you can use it and delete the entire folder if you wish without any affects on your system.

Goodluck.

share|improve this answer
1  
so should I just sudo apt-get install clang-3.4 ? –  Martin Drozdik Feb 4 at 16:23
1  
@MartinDrozdik yes. search was to so you could see what you could install. –  myusuf3 Feb 4 at 18:46
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.