[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

c++ hello world help



Hi D-u,
I'm trying to get gcc to compile some basic c++ programs and I'm running
into some probably some really basic setup mistakes.
gcc works with C programs.
but c++ programs cant find the libs.
=====================================================

~/cpluscplus\% cat page23.cpp 
#include <iostream.h>
int main() { cout << "Hello, World!\n"; return 0; }

~/cpluscplus\% g++ page23.cpp 
In file included from /usr/include/c++/3.3/backward/iostream.h:31,
from page23.cpp:1:
 /usr/include/c++/3.3/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
 <sstream> instead of the deprecated header
 <strstream.h>. To disable this warning use
 -Wno-deprecated.
 kevin@165.247.40.180/730/0 :~/cpluscplus\
(this compiles)
 ===========================================================
 but
 ==========================================================
~/cpluscplus\% gcc page23.cpp 
 In file included from /usr/include/c++/3.3/backward/iostream.h:31,
 from page23.cpp:1:
  /usr/include/c++/3.3/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
  <sstream> instead of the deprecated header
  <strstream.h>. To disable this warning use
  -Wno-deprecated.
  /tmp/ccyxfHIz.o(.text+0x1b): In function `main':
  : undefined reference to `std::cout'
  /tmp/ccyxfHIz.o(.text+0x20): 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*)'
  /tmp/ccyxfHIz.o(.text+0x49): In function
  `__static_initialization_and_destruction_0(int, int)':
  : undefined reference to
  `std::ios_base::Init::Init[in-charge]()'
  /tmp/ccyxfHIz.o(.text+0x7a): In function `__tcf_0':
  : undefined reference to `std::ios_base::Init::~Init
  [in-charge]()'
  /tmp/ccyxfHIz.o(.eh_frame+0x11): undefined reference
  to `__gxx_personality_v0'
  collect2: ld returned 1 exit status
  kevin@165.247.40.180/730/0 :~/cpluscplus\% 
  -----------------------------------------------------------
  I installed libstdc++ and gcc versions 2.95,3.2,3.3
  WHAT FILES DO I HAVE TO CONFIGURE OR INSTALL!
  TIA
  -Kev

Attachment: signature.asc
Description: Digital signature


Reply to: