[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: [NOVICE] C++



On Tue, May 08, 2001 at 00:08:48 +0200, Fanch wrote:

> 
> Jeg prøver at lære lidt programmering i C++ og til dette formål
> har jeg anskaffet mig IDG's "C++" af Kris Jamsa. Desværre er det
> skrivet til windows brugere og jeg kender intet til Windows eller
> DOS. Jeg er nemlig begyndt med Linux for ca 1½ år siden på min
> første PC uden kendskab til noget andet... Men det står i denne
> hæfte at det også skulle kunne lad sig gøre at bruge eksemplerne
> i Unix systemer, bare man har den rigtige kompiler. Jeg har Gcc
> og har forsøgt at gennemføre det første lille eksempel, som
> skulle bare skrive på skærmen: "Programmering i C++!". Når jeg
> skriver kommandoen:
....

Vi bør fortsætte på sslug-cprog listen som er til dette formal.
(cc til denne gruppe)

> $ gcc start.C

1) bedre at kalde oversætteren med :
 
   g++ -Wall start.C -o start

> 
> får jeg følgende besked:
> 
> /tmp/ccANVyFb.o: In function `main':
> /tmp/ccANVyFb.o(.text+0x9): undefined reference to `cout'
> /tmp/ccANVyFb.o(.text+0xe): undefined reference to `ostream::operator<<(char const *)'
> collect2: ld returned 1 exit status

2)
  Husk at lave include på de rigtige bibilioteker , filernes
 navne er lidt anderledes end andre c++ oversættere
 hvor man f.eks. ville anvende <iostream> :

#include <iostream.h>

int main(int argc, char **argv) {
  cout << "[" << argv[0] << "]" << endl;
 return 0;
}

Du kan evt. se i /usr/include/g++/ for at finde ud af hvad der findes.

-- 
Frank Damgaard 



 
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] *