Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse using wrong version of g++
Eclipse using wrong version of g++ [message #912587] Thu, 13 September 2012 20:12 Go to next message
America Chambers is currently offline America ChambersFriend
Messages: 2
Registered: September 2012
Junior Member
I have written my own Makefile (instead of having Eclipse generate one for me automatically).

When I build my C++ project within Eclipse (Indigo) it uses /usr/bin/g++ which is a symbolic link to an older version of g++ (g++-4.2).

The problem is that I have updated my version of gcc to gcc-4.4. Opening up a terminal, it is clear that this newer version of gcc has been correctly installed as the default (like I wanted).

>> g++ --version
g++ (MacPorts gcc44 4.4.7_2) 4.4.7
Copyright (C) 2010 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.

>> which g++
/opt/local/bin/g++


>> ls /opt/local/bin/g++
lrwxr-xr-x 1 root admin 25 Sep 13 12:16 /opt/local/bin/g++ -> /opt/local/bin/g++-mp-4.4

>> echo $PATH
/opt/local/bin:...:/usr/bin...


So why is eclipse still using the old version of g++? Is there some property somewhere where I can specify the directory of the new g++ compiler? I would prefer to change where Eclipse is looking instead of changing my system paths or my Makefile.

I added the path /opt/local/bin to Eclipse's build variable PATH and made sure it was before /usr/bin (Eclipse >> Preferences >> Build >> Build Variables) but this did not solve the issue.


If I need to post my Makefile, what OS I'm running, etc. let me know. This is my first time posting.
Re: Eclipse using wrong version of g++ [message #912645 is a reply to message #912587] Thu, 13 September 2012 22:59 Go to previous message
America Chambers is currently offline America ChambersFriend
Messages: 2
Registered: September 2012
Junior Member
I (think) I figured it out. You'd have to do this for each project. There is a project specific PATH variable in:

Properties >> C/C++ Build >> Environment

I added /opt/local/bin to this PATH variable and it worked. There is a different PATH variable in:

Properties >> C/C++ Build >> Build Variables

but for some reason editing this PATH variable doesn't change the path to the compiler. Odd.
Previous Topic:resolving imports from an ECOS library
Next Topic:Type not found across project references
Goto Forum:
  


Current Time: Tue Apr 23 13:22:06 GMT 2024

Powered by FUDForum. Page generated in 0.03564 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top