Pointing CodeLite to new compiler (GCC 4.8.x)

General questions regarding the usage of CodeLite
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Pointing CodeLite to new compiler (GCC 4.8.x)

Post by mikey »

I am running CodeLite 5.2 on Ubuntu 12.04 LTS (downgraded from 13.04, which has some stability problems right now).

I just installed the GCC 4.8 compiler, which is not the default GCC compiler on 12.04. I need this compiler to get all the C++ 11 features it supports and were there by default with the compiler that comes with 13.04, using the ‘-std=c++11' switch.

So now I have 4.8 compiler installed, but I can't figure out how to tell CodeLite to use that compiler instead of the default GCC compiler that comes with 12.04 (4.4.x?). How do I do this?
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by eranif »

I think that the prefered way is to use update-alternative to point to the version of the compiler that you want
You can also go to :Settings -> Build Settings -> Compiler and replace the various 'gcc' / 'g++' entries with a full path to your compiler

Eran
Make sure you have read the HOW TO POST thread
Gibbon1
CodeLite Expert
Posts: 167
Joined: Fri Jul 22, 2011 5:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by Gibbon1 »

I have two suggestions from the peanut gallery.

About the build setting panel that would make it a lot easier to use.

1. Add a field for the path to the compilers bin folder.
2. Add a copy feature so you can copy a compiler setting.
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by mikey »

I will try doing it in codelite too but it seems that as Efran mentioned, you can do that kind of thing with update-alternative - which tells the whole system to use that compiler as the default GCC compiler. Not sure of the syntax I need though.
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by mikey »

Eran - update-alternative - do you know syntax for getting to change default of GCC? I put a question on AskUbuntu but that site isn't very strong - no answers.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by DavidGH »

Hi,

I had a quick look at the update-alternatives man page.

See what's available with:
update-alternatives --display c++

Select one with:
update-alternatives --config c++
entering your preferred selection when asked.

Regards,

David
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by mikey »

Thanks - will check it out. Still new to Linux - have to start making a habit of looking at man pages.
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by mikey »

update-alternatives --config c++ told me there are no alternatives available for the GCC stuff that's in there. I reinstalled everything with Synaptic - the packages are there. There is more that needs to be done.

Check this if it interests you:

Choose gcc and g++ version
http://askubuntu.com/questions/26498/ch ... -g-version

- I have to go through it again to make sure I know that it's doing - afraid I'll break everything.

Thanks
M
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by DavidGH »

Are you sure you want to do this? It would be probably be easier, and certainly safer, just to use the full path to your chosen g++ version inside CodeLite.

If you do want a global change, and update-alternatives isn't co-operating, what I'd do is simply to use a file manager (I use, ahem, 4Pane) to change the destinations of the symlinks /usr/bin/g++ and /usr/bin/gcc.
(Yes, that means running a file manager with superuser privileges, which some will advise against. But IMHO it's less dangerous for an inexperienced user to be superuser in a gui than from the command-line.)
mikey
CodeLite Enthusiast
Posts: 24
Joined: Thu Apr 18, 2013 9:46 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Pointing CodeLite to new compiler (GCC 4.8.x)

Post by mikey »

It would be probably be easier, and certainly safer, just to use the full path to your chosen g++ version inside CodeLite.

That's probably what I'll do, once I figure out all the right paths. Synaptic is good for that.

Tnx
Post Reply