473,320 Members | 1,987 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,320 software developers and data experts.

undefined reference to std::cout

i program under linux ,and using kdevelop c/c++.
the code follow,
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[])
{
cout << "Hello, from Win32!" << endl;

return EXIT_SUCCESS;
}
when #gcc -p ty.cpp
error :
root@localhost src]# gcc -p ty.cpp
/tmp/ccsuKY9I.o(.text+0x2a): In function `main':
ty.cpp: undefined reference to `std::cout'
/tmp/ccsuKY9I.o(.text+0x2f):ty.cpp: 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/ccsuKY9I.o(.text+0x3a):ty.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccsuKY9I.o(.text+0x40):ty.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccsuKY9I.o(.text+0x62): In function `__tcf_0':
ty.cpp: undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccsuKY9I.o(.text+0x8f): In function `__static_initialization_and_destruction_0(int, int)':
ty.cpp: undefined reference to `std::ios_base::Init::Init()'
/tmp/ccsuKY9I.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

how to solove this problem
think you .i use linux for a few days .
Jun 7 '07 #1
1 10844
Motoma
3,237 Expert 2GB
What version of gcc and kdevelop are you using?

You will probably need to run the ./configure script that kdevelop creates for you.
Jun 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pmb | last post by:
I've noticed a lot of people preferring std::cout over cout. May I ask why you prefer one over the other? thanks Pmb
12
by: Minti | last post by:
Is std::cout slower than printf When we call printf e.g. in printf(20 format conversion specifications, 20 arguments); Is it faster than the std::cout << { 20 redirections to the output...
6
by: clilley | last post by:
The following code causes a segmentation fault on DEC Tru64: foo.cc (built into libFoo.so) //--------------------------- include <iostream> bool createFoo() { std::cout << "createFoo" <<...
3
by: Jason Heyes | last post by:
I have a function that reads tags. The function prints any failures it encounters to std::cout. std::istream &read_tag(std::istream &is, std::string &tag) { std::string s; if (!(is >> s)) {...
19
by: Dancefire | last post by:
Hi, everyone It might be a simple question, but I really don't know the answer. char c = '1'; cout << c; The above code will only output a '1' rather than 0x31; If I use int cast, it can...
6
by: Roger | last post by:
Hello, I'm pretty new to C++ programming, and I'm teaching myself the language using various sources. This sounds stupid, but I am really confused on this... I was wondering why we have to write...
5
by: wongjoekmeu | last post by:
Dear All, I have written a small program to read in from console a user string. I wanted to be able to read in a string containing of all sorts of characters untill the user press enter. I have to...
11
by: Adrian | last post by:
Is it possible to save a copy of cout the same way you can save a copy of stdout in C (I know C version is portable, but unix portable is good enough for me). I have to use a library which...
58
by: Mark Casternoff | last post by:
I'm getting back into C++ after a long hiatus (they didn't have namespaces back then). I know this question is completely subjective, but I'd be interested in hearing which is the "better"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.