Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » g++ not recognized -> not building!
g++ not recognized -> not building! [message #212423] Sat, 22 March 2008 20:26 Go to next message
Eclipse UserFriend
Hi everyone,

I started working on Mac OS so I ported all my C++ code that I worked with
on Ubuntu Linux. Since there was an old version of the GCC compiler, I
compiled version 4.3 using macports and now is under /opt/local/bin. Using
autotools I run the script with flag CXX=g++-mp-4.3 so that I use the
newer version of GCC. Then I type make on a terminal and everything goes
fine, I can compile my code. However, if I try to build the project in
Eclipse, I get the following:


**** Build of configuration Default for project xFEM ****

make all
make all-recursive
Making all in src
g++-mp-4.3 -DHAVE_CONFIG_H -I. -I..
-I/Users/aaragon/Workspace/loki-0.1.6/include
-I/Users/aaragon/Workspace/CGAL/include -g -O2 -MT matrix.o -MD -MP -MF
deps/matrix.Tpo -c -o matrix.o matrix.cxx
make[2]: g++-mp-4.3: Command not found
make[2]: *** [matrix.o] Error 127
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

The command is found when using the terminal. How can I tell eclipse that
the command exists??? Thanks for the help,

aa
Re: g++ not recognized -> not building! [message #212491 is a reply to message #212423] Mon, 24 March 2008 17:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jim.marshall.wbemsolutions.com

Alejandro Aragon wrote:
> Hi everyone,
>
> I started working on Mac OS so I ported all my C++ code that I worked
> with on Ubuntu Linux. Since there was an old version of the GCC
> compiler, I compiled version 4.3 using macports and now is under
> /opt/local/bin. Using autotools I run the script with flag
> CXX=g++-mp-4.3 so that I use the newer version of GCC. Then I type make
> on a terminal and everything goes fine, I can compile my code. However,
> if I try to build the project in Eclipse, I get the following:
>
>
> **** Build of configuration Default for project xFEM ****
>
> make all make all-recursive
> Making all in src
> g++-mp-4.3 -DHAVE_CONFIG_H -I. -I..
> -I/Users/aaragon/Workspace/loki-0.1.6/include
> -I/Users/aaragon/Workspace/CGAL/include -g -O2 -MT matrix.o -MD -MP
> -MF deps/matrix.Tpo -c -o matrix.o matrix.cxx
> make[2]: g++-mp-4.3: Command not found
> make[2]: *** [matrix.o] Error 127
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
>
> The command is found when using the terminal. How can I tell eclipse
> that the command exists??? Thanks for the help,
>
> aa
>
>
Do you have opt/local/bin in your path?
Re: g++ not recognized -> not building! [message #212507 is a reply to message #212491] Mon, 24 March 2008 20:08 Go to previous messageGo to next message
Eclipse UserFriend
Well, I open a terminal and I have

echo $PATH
/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/b in:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/ bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin

so yes, it is on the path. However, when I open eclipse it doesn't find
it. I tried opening eclipse from the terminal, and then it found the
command. It's just that the PATH is not recognized by eclipse when it
starts up (not from the terminal). I'm on Mac OS and I really don't know
where to set this in order for eclipse to find out the path.

aa
Re: g++ not recognized -> not building! [message #212515 is a reply to message #212491] Mon, 24 March 2008 21:14 Go to previous message
Eclipse UserFriend
SOLVED!!!!!

It took me some time to figure this out, but I found a way to do this. It
turns out that all applications that are run in Mac OS inherit from the
environmental variables of the window manager. So basically you have to
create a file to provide the path environmental variable that will be
loaded by the window manager. These are the steps:

Open a terminal and

$> cd (go to the home directory)
$> mkdir .MacOSX
$> cd .MacOSX
$> touch environment.plist

Now you have to create xml code for the environmental variables that you
will use. Thus, you can use the Property List Editor that comes with the
Developer tools in Mac OS. When you open the editor just click New Root,
select Root and click New Child (this is the environmental variable). Now
in the New Item, add PATH, leave string as the Dictionary and then put the
value to whatever PATH you want. In my case is just the output from the
terminal:

$> echo $PATH
/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/b in:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/ bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin: /usr/X11R6/bin

Then click on Dump to produce the xml code containing the environmental
variable. Copy that text into the newly created environment.plist file.
This is what I had:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs\
/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>

<string> /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbi n:/\
usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr /X11/bin:/usr/X11R6\
/bin</string>
</dict>
</plist>

Now you just have to RESTART the machine so that the window manager reads
the newly created file.

That's it. Someone should put this somewhere for the new users of eclipse,
is there a Wiki or something like this? or a FAQ???

aa
Previous Topic:Not including include files
Next Topic:gdb non termination
Goto Forum:
  


Current Time: Thu May 08 15:54:58 EDT 2025

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

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

Back to the top