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



In article <sslug@sslug> you wrote:



> #include <iostream.h>
> void main(void)
> {
> 	cout << "Programmering i C++!" ;
> }

> Den går ikke her. Men hvis jeg skriver:

> #include <iostream.h>
> int main(int argc, char **argv)
> {
> 	cout << "Programmering i C++!" <<endl;
> }

Enesye forskel er "endl" og den behøves ikke, MEN, "endl"
gør nomralt også at output buffer "flushes/tømmmes".
Dette sker normalt automatisk når programmet slutter.

> så går det. Jeg bruger også denne kommando som du har givet mig
> til at kalde kompileren : g++ -Wall start.C -o start


> Kan du forklare mig alle de argumenter du gør brug af i dine
> sætninger, eller hvor jeg kan få en forklaring på dem?

"man gcc", "man g++", og har man info-siderne installeret
så er der meget mere udførlig hjælpe med "info gcc" eller "info g++".
Dog pas på, har man ikke info siderne installere, så vil 
info blot give det samme som manualsiden.

> Jeg har også undret mig over hvordan man finder ud af hvilken
> include-fil man skal nævne. Det virker for resten også med
> stdiostream.h.

Egentlig bør det være <iostream> eller en af de andre streams.
( <ostream>, <istream>, ....)
Forskellen er hhv. inp+output, output, input,...
Men det bør en god C++ bog nævne.

Gnu C++ er lidt "underlig"/"gammeldags" vedrørende stream filerne
og vil normalt have .h, dvs: <iostream.h> osv.

Ellers vil man normalt kunne nøjes med <string>, <stddef>, osv.

I øvrigt hvis du vil have mere fejlcheck i oversættelsen udover
-Wall, så prøv også -pedantic :)
Vil du have debug info til debuggerne (gdb, xdb,...)
så tilføj -g . 
Dvs.:

  g++ -Wall -pedantic -g prog.C -o prog



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