LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 06-05-2004, 05:36 AM   #1
Lgoat
LQ Newbie
 
Registered: Feb 2004
Location: somewhere incredible
Distribution: slackware!
Posts: 23

Rep: Reputation: 15
Why isn't this working?


When i try to compile my test program with this command:

Code:
gcc -o test test.cpp
I get this error thrown in my face:

Code:
In file included from /usr/include/c++/3.2.3/backward/iostream.h:31,                  from test.cpp:1: /usr/include/c++/3.2.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. test.cpp:8:2: warning: no newline at end of file /tmp/ccrlko53.o(.text+0x19): In function `main': : undefined reference to `std::cout' /tmp/ccrlko53.o(.text+0x1e): In function `main': : 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/ccrlko53.o(.text+0x4a): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `std::ios_base::Init::Init[in-charge]()' /tmp/ccrlko53.o(.text+0x79): In function `__tcf_0': : undefined reference to `std::ios_base::Init::~Init [in-charge]()' /tmp/ccrlko53.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status

This is the test program that should be able to run:

Code:
#include <iostream.h>
int main()
{ 
cout << "heey";  
return 0;
}

Last edited by Lgoat; 06-05-2004 at 05:38 AM.
 
Old 06-05-2004, 05:58 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
I believe you need to compile with g++, not gcc.
 
Old 06-05-2004, 07:42 AM   #3
zmieff
Member
 
Registered: Feb 2004
Location: Austria
Distribution: NetBSD 2.0, DragonFlyBSD 1.0
Posts: 66

Rep: Reputation: 15
additionally,

you should us <iostream> instead of <iostream.h>

and
using namespace std; right below the include section
 
Old 06-05-2004, 08:20 AM   #4
Lgoat
LQ Newbie
 
Registered: Feb 2004
Location: somewhere incredible
Distribution: slackware!
Posts: 23

Original Poster
Rep: Reputation: 15
Wow the g++ thing worked. its just because someone in another post told me to use gcc
 
  


Reply



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
Intel sound not working, usb modem not working. siriusb Linux - Hardware 8 03-04-2006 10:16 PM
After Online update: Hard drive working and working dacosta SUSE / openSUSE 6 11-06-2004 12:14 AM
F1 - F10 not working when F13 - F20 working in Linux haivinay Linux - General 0 09-20-2004 07:31 AM
Link/Applet not working in all Linux browsers, but working in IE MasterPatricko Linux - Software 6 09-04-2004 03:39 AM
cannot download files in mozilla -save dialog not working, galeon not working cmisip Linux - General 0 08-03-2003 03:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration