iostream error.

P

Prasad

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 said:
(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
 
I

Ian Collins

Prasad said:
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++.
 
R

rageratwork

Prasad said:
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,


/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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top