New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Problem running g++ from terminal window


Post Reply New Thread Subscribe

 
Thread Tools
kimgh

 
Member Since: Mar 30, 2012
Posts: 2
kimgh is on a distinguished road

kimgh is offline
I have this infuriating problem; I'm trying to compile a simple example from Stroustrup's book on C++:

g++ char.gpp -o char

I get the following error:

ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status

So, I found where crt1.10.6.o is, and set LIBRARY_PATH to:

/Developer/SDKs/MacOSX10.6.sdk/usr/lib

and then the compile step gives:

ld: warning: in char.gpp, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

This is in Lion with the latest Xcode newly installed. The library crt1.10.6.o seems to be the issue.

Failing that, is there a way to run the Xcode to generate a command-line executable?
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 170
Mark FX has a spectacular aura about

Mark FX is offline
I'm running Xcode 4.2, and there is a command line tool project template in the Mac OSX applications category, when starting a new project from the file menu.
But I dont know if this template is still available in the latest 4.3 version of Xcode, I would find it hard to
believe, they have ditched this template in the latest release of Xcode.

So if the command line tool project template is still available, then thats what I would, and have used previously.

Sorry I could not be more help.

Regards Mark
QUOTE Thanks
kimgh

 
Member Since: Mar 30, 2012
Posts: 2
kimgh is on a distinguished road

kimgh is offline
I've figured out one thing: the file should probably have ".cc" rather than ".gpp" as the suffix. I guess .gpp refers to a preprocessed file.

So then the problem becomes:

char.cc:1:20: error: iostream: No such file or directory

Header files are in the /Developer/SDKs/.... but I would expect the compiler to know where to find these files.

So I'm not quite there. I'd appreciate any help; I'd really like to compile files from the terminal while practicing C++ coding.
QUOTE Thanks

Post Reply New Thread Subscribe


« disable control-f4 i.e., cycle between open windows in all applications in mac | Using TextMate with Python »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Problem with Terminal app on OS X Lion jsherk OS X - Operating System 3 01-18-2012 03:46 PM
Macintosh Snow Leopard: Terminal Problem Metal OS X - Apps and Games 11 10-03-2010 07:42 PM
Terminal Won't Open icefall5 OS X - Operating System 7 08-25-2010 09:26 AM
weird window closing problem - help please! pennink@dircon. OS X - Operating System 0 02-11-2009 04:32 PM
terminal window sexton Running Windows (or anything else) on your Mac 3 10-22-2003 01:40 AM

All times are GMT -4. The time now is 01:30 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?