View Single Post
  #1   (View Single Post)  
Old 26th July 2008
Gates Gates is offline
New User
 
Join Date: Jul 2008
Posts: 4
Default c++ compiling hello world

As you can guess i am totally new in this theme. I do not understand error message, so i am asking for your help. Why can't i compile this program:
Code:
#include <iostream.h>

int main()
{
  cout << "Hello World!\n";
  return 0;
}
Error:
Code:
%gcc n01-hello.cpp
In file included from /usr/include/c++/3.4/backward/iostream.h:31,
                 from n01-hello.cpp:1:
/usr/include/c++/3.4/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 <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
n01-hello.cpp:7:2: warning: no newline at end of file
/var/tmp//ccLD53t1.o(.text+0xd): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::size() const'
/var/tmp//ccLD53t1.o(.text+0x60): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccLD53t1.o(.text+0x9d): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccLD53t1.o(.text+0xc8): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccLD53t1.o(.text+0x121): In function `main':
: undefined reference to `std::cout'
/var/tmp//ccLD53t1.o(.text+0x126): 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*)'
/var/tmp//ccLD53t1.o(.text+0x152): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
/var/tmp//ccLD53t1.o(.text+0x183): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
/var/tmp//ccLD53t1.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
%
Reply With Quote