Fedora Linux Support Community & Resources Center
  #1  
Old 11th August 2006, 10:39 PM
sieg1974
Guest
 
Posts: n/a
undefined references when linking c++ program

Hi all,

I'm getting the following error messages when gcc links hello.cpp. Does anybody know what's wrong?

Thanks,

Andre
************************************************** *********
hello.cpp :

#include <iostream>
using namespace std;

int main()
{
cout << "Hello world\n";
return 0;
}
************************************************** *********
Error messages:

$ gcc ./hello.cpp
/tmp/ccLP9XEQ.o: In function `__static_initialization_and_destruction_0(int, int)':singleton.cpp.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccLP9XEQ.o: In function `__tcf_0':singleton.cpp.text+0x6c): undefined reference to std::ios_base::Init::~Init()'
/tmp/ccLP9XEQ.o: In function `main':singleton.cpp.text+0x8e): undefined reference to `std::cout'
:singleton.cpp.text+0x93): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccLP9XEQ.o.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Reply With Quote
  #2  
Old 12th August 2006, 09:55 AM
markkuk Offline
Registered User
 
Join Date: Apr 2005
Location: Finland
Posts: 5,076
Use the "g++" command when compiling/linking a C++ program, it will automatically link with the C++ runtime library.
Reply With Quote
Reply

Tags
linking, program, references, undefined

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel references in /lib/modules/2.6.23.17-88.fc7 missing pailott Using Fedora 2 26th January 2009 05:42 PM
Linking references to functions 100%digital Using Fedora 3 7th July 2007 10:58 PM
LaTeX references joa Using Fedora 0 30th September 2005 05:03 PM
MADWIFI and unresolved references rjmPowderhorn Servers & Networking 3 1st August 2004 05:11 PM


Current GMT-time: 23:25 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat