LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-05-2005, 03:54 PM   #1
JimChristiansen
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
Simple C++ code won't compile on 2 out of 3 systems


I need some help to sort out why only my old 30 Fedora 2 school boxes will compile:

#include <iostream>
using namespace std;
int main( )
{
cout << "Hello World!!";
}


While my two thin servers running Fedora 3 and 4 serving 100 clients fails to compile... with:

[jim@adminmrc Programming]$ gcc -Wall -o dallasisspecial dallas.cpp
/tmp/ccAdWbGa.o(.text+0xd): In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
/tmp/ccAdWbGa.o(.text+0x60): In function `std::__verify_grouping(char const*, unsigned int,
.
.
.
: undefined reference to `std::cout'
/tmp/ccAdWbGa.o(.text+0x126): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccAdWbGa.o(.text+0x152): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
/tmp/ccAdWbGa.o(.text+0x181): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccAdWbGa.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Thanks, Jim
 
Old 12-05-2005, 04:01 PM   #2
Hivemind
Member
 
Registered: Sep 2004
Posts: 273

Rep: Reputation: 30
Use g++ to compile C++-programs, gcc is for C-programs.
 
Old 12-05-2005, 04:31 PM   #3
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Your main method expects an Integer as return value too. Don't forget to have a return 0; or something at the end.
 
Old 12-05-2005, 07:13 PM   #4
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
Just in case you were wondering

g++ = gcc -lstdc++
 
Old 12-06-2005, 04:52 PM   #5
JimChristiansen
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks!

Thanks!

OHH!!! Just too many thing going on I guess to think straight.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple PHP code aznita Programming 1 06-19-2005 11:50 PM
compile/linker problem with simple libipq code TheLinuxDuck Programming 7 05-06-2005 01:28 PM
Interpret this simple C code Chase_G Programming 4 04-29-2005 09:07 AM
to become giddy in simple code Hamid Moradmand Programming 2 05-18-2004 06:23 PM
simple code *help a newbie out* alimharji Programming 7 03-14-2004 01:23 PM


All times are GMT -5. The time now is 11:44 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration