473,385 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

iostream error.

Hi All,

I am executing simple hello world program. But, getting compile time
errors.
What is the problem here?

prasad@D-T11673A:~/programs/c> cat bst.cpp
#include<iostream>

using namespace std;

int main ()
{
cout << "Hello World." ;
return 0 ;

}

prasad@D-T11673A:~/programs/c> gcc bst.cpp
/tmp/ccrmoRpD.o: In function `main':
bst.cpp:(.text+0x25): undefined reference to `std::cout'
bst.cpp:(.text+0x2a): 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/ccrmoRpD.o: In function `__tcf_0':
bst.cpp:(.text+0x47): undefined reference to
`std::ios_base::Init::~Init()'
/tmp/ccrmoRpD.o: In function
`__static_initialization_and_destruction_0(int, int)':
bst.cpp:(.text+0x74): undefined reference to
`std::ios_base::Init::Init()'
/tmp/ccrmoRpD.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

prasad@D-T11673A:~/programs/c> echo $?
1

Thanks & regards,
Prasad

May 4 '06 #1
2 2883
Prasad wrote:
Hi All,

I am executing simple hello world program. But, getting compile time
errors.
What is the problem here?

prasad@D-T11673A:~/programs/c> cat bst.cpp
#include<iostream>

using namespace std;

int main ()
{
cout << "Hello World." ;
return 0 ;

}

prasad@D-T11673A:~/programs/c> gcc bst.cpp


Use g++.

--
Ian Collins.
May 4 '06 #2
Prasad wrote:
Hi All,

I am executing simple hello world program. But, getting compile time
errors.
What is the problem here?

prasad@D-T11673A:~/programs/c> cat bst.cpp
#include<iostream>

using namespace std;

int main ()
{
cout << "Hello World." ;
return 0 ;

}

prasad@D-T11673A:~/programs/c> gcc bst.cpp
/tmp/ccrmoRpD.o: In function `main':
bst.cpp:(.text+0x25): undefined reference to `std::cout'
bst.cpp:(.text+0x2a): 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/ccrmoRpD.o: In function `__tcf_0':
bst.cpp:(.text+0x47): undefined reference to
`std::ios_base::Init::~Init()'
/tmp/ccrmoRpD.o: In function
`__static_initialization_and_destruction_0(int, int)':
bst.cpp:(.text+0x74): undefined reference to
`std::ios_base::Init::Init()'
/tmp/ccrmoRpD.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

prasad@D-T11673A:~/programs/c> echo $?
1

Thanks & regards,
Prasad


Use:

gcc bst.cpp -lstdc++

or:

g++ bst.cpp

Dave.

May 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: John Tiger | last post by:
Can anybody have idea about the difference between #include <iostream.h> and #include <iostream>. Is later one valid statement on any compiler. I tried compiling on MSVC second statement give...
13
by: David Rubin | last post by:
I get an error when I compile the following code: #include <algorithm> #include <cctype> #include <iostream> #include <string> using namespace std; string&
1
by: Pradyot Dhulipala | last post by:
Hi, I am using ns2.26 with the Makefile using C++ compiler version c++ (GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk). When I use iostream.h in a simple program and compile with c++ everything works...
9
by: ai | last post by:
Hi , I have an application which has to read files of size few mba nd read them into array . Since i am using STL and std namespace to avoid the error error C2872: 'ifstream' : ambiguous...
2
by: humble04 | last post by:
Hi, I am compiling a collection of C++ code. Most of them are using the new format #include <iostream>. I think all of them because I failed at finding out which header file uses the old format ...
1
by: Bill Sun | last post by:
Hi, I just want to using a console application in the .net enviroment. Before the main(), I using the #include "iostream.h" but the .net tell me:...
1
by: ya man | last post by:
when i use #include <iostream.h> in some files i get lots of error messages of the kind 'ambiguous symbol this is solved when i use #include <iostream why is that ? and can i use #include...
8
by: mmu2643 | last post by:
Hi, I was trying to compile the following bit of code: #include <iostream.h> main(){ cout<<"Hello World!";
2
by: Chris Jones | last post by:
I am using the old <iostream.h>. When I compile a simple test program that uses <iostream.h>, Visual C++ 7 gives me this strange error: Compiling... capp.cpp C:\Program Files\Microsoft Visual...
0
by: Herman.Schultz | last post by:
Hi, I am trying to use C++ iostream in Darwin (apple opensource streaming server) source code. Here is what I did: 1. Add these in the file #include <iostream> using namespace std; 2. Add...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.