[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] problemer med at linke til iostream



On Tue, 16 May 2000, Stig Nielsson wrote:

> Hejsa,
> 
> Jeg prøver at få cout og cin til at virke med gcc.
> Jeg har lavet det simplest mulige program:
> 
> #include <iostream>
> int main(){
>     cout << "hej\n" ;
> }
> 
> Dette kan godt kompileres, men linkingen giver noget ala :
> 
> /tmp/ccQK0Prg.o: In function 'main':
> /tmp/ccQK0Prg.o(.text+0x9): undefined reference to 'cout'
> /tmp/ccQK0Prg.o(.text+0xe): undefined reference to
> 'ostream::operator<<(char const *) '
> collect2 : ld returned 1 exit status
> 
> Hvad er der galt ? Skal jeg selv specificere hvilken fil jeg vil linke
> mod ? Jeg troede ellers at iostream var et standard library i C++, i
> stil med stdio i C.
> 
> Mvh. Stig Nielsson
> 

Du skal linke med standard biblioteket:

% g++ -lstdc++ -o cpptest cpptest.cpp

Jonas

Eml: sslug@sslug || ICQ: 62401545
WWW: http://hjem.wanadoo.dk/~wan17111/



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *