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(.tex t+0x2a): In function `main':
ty.cpp: undefined reference to `std::cout'
/tmp/ccsuKY9I.o(.tex t+0x2f):ty.cpp: undefined reference to `std::basic_ost ream<char, std::char_trait s<char> >& std::operator<< <std::char_trai ts<char> >(std::basic_os tream<char, std::char_trait s<char> >&, char const*)'
/tmp/ccsuKY9I.o(.tex t+0x3a):ty.cpp: undefined reference to `std::basic_ost ream<char, std::char_trait s<char> >& std::endl<char, std::char_trait s<char> >(std::basic_os tream<char, std::char_trait s<char> >&)'
/tmp/ccsuKY9I.o(.tex t+0x40):ty.cpp: undefined reference to `std::basic_ost ream<char, std::char_trait s<char> >::operator<<(s td::basic_ostre am<char, std::char_trait s<char> >& (*)(std::basic_ ostream<char, std::char_trait s<char> >&))'
/tmp/ccsuKY9I.o(.tex t+0x62): In function `__tcf_0':
ty.cpp: undefined reference to `std::ios_base: :Init::~Init()'
/tmp/ccsuKY9I.o(.tex t+0x8f): In function `__static_initi alization_and_d estruction_0(in t, int)':
ty.cpp: undefined reference to `std::ios_base: :Init::Init()'
/tmp/ccsuKY9I.o(.eh_ frame+0x11): undefined reference to `__gxx_personal ity_v0'
collect2: ld returned 1 exit status
how to solove this problem
think you .i use linux for a few days .
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(.tex t+0x2a): In function `main':
ty.cpp: undefined reference to `std::cout'
/tmp/ccsuKY9I.o(.tex t+0x2f):ty.cpp: undefined reference to `std::basic_ost ream<char, std::char_trait s<char> >& std::operator<< <std::char_trai ts<char> >(std::basic_os tream<char, std::char_trait s<char> >&, char const*)'
/tmp/ccsuKY9I.o(.tex t+0x3a):ty.cpp: undefined reference to `std::basic_ost ream<char, std::char_trait s<char> >& std::endl<char, std::char_trait s<char> >(std::basic_os tream<char, std::char_trait s<char> >&)'
/tmp/ccsuKY9I.o(.tex t+0x40):ty.cpp: undefined reference to `std::basic_ost ream<char, std::char_trait s<char> >::operator<<(s td::basic_ostre am<char, std::char_trait s<char> >& (*)(std::basic_ ostream<char, std::char_trait s<char> >&))'
/tmp/ccsuKY9I.o(.tex t+0x62): In function `__tcf_0':
ty.cpp: undefined reference to `std::ios_base: :Init::~Init()'
/tmp/ccsuKY9I.o(.tex t+0x8f): In function `__static_initi alization_and_d estruction_0(in t, int)':
ty.cpp: undefined reference to `std::ios_base: :Init::Init()'
/tmp/ccsuKY9I.o(.eh_ frame+0x11): undefined reference to `__gxx_personal ity_v0'
collect2: ld returned 1 exit status
how to solove this problem
think you .i use linux for a few days .
Comment