Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > GCC 4.0 linking error when using command line

GCC 4.0 linking error when using command line
Thread Tools
Junior Member
Join Date: Jul 2001
Location: Chicago, IL USA
Status: Offline
Reply With Quote
Mar 19, 2007, 07:13 PM
 
I've done some searching and can't seem to figure this one out. I have dumbed it down to just a plain old Hello World program:
[codex]
#include <iostream>

int main (int argc, char * const argv[]) {
std::cout << "Hello, World!\n";
return 0;
}
[/codex]

I compile on the command line with:

gcc HelloWorld.cpp


And I get the following error:
[codex]/usr/bin/ld: Undefined symbols:
std::ios_base::Init::Init()
std::ios_base::Init::~Init()
std::cout
std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
___gxx_personality_v0
collect2: ld returned 1 exit status
[/codex]

I appear to be missing something, and I have no idea what it is. Any clues? Google is not helping, and nothing in the archives here seem to help.
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Mar 19, 2007, 07:16 PM
 
Use g++ instead, or the appropriate flag for gcc.
     
bri-guy  (op)
Junior Member
Join Date: Jul 2001
Location: Chicago, IL USA
Status: Offline
Reply With Quote
Mar 19, 2007, 07:33 PM
 
Thanks, I was just paging through the man pages for gcc and noticed g++, which I had forgotten about. That solves it.
     
Fresh-Faced Recruit
Join Date: Mar 2007
Status: Offline
Reply With Quote
Mar 20, 2007, 09:45 AM
 
Is there a way to diable the built in iSight webcam in favor of a independant cam?
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -5. The time now is 02:48 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2