PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : c++ compilen



SupaSONiC
19-11-2001, 15:42
Hi!
Ist warscheinlich eine ziemliche Newbie-Frage aber ich weiß nich weiter. Ich hab hier ein C++ buch, darin war der übliche hello-world-quelltext:
::(mathis)::(android.prosaqx.org)::(~/cpp):: cat cpp.c
#include <stdio.h>

int main() {
cout << "Hello World";
}
wenn ich versuche, das zu compilen:
::(mathis)::(android.prosaqx.org)::(~/cpp):: gcc -o cpp cpp.c
cpp.c: In function `main':
cpp.c:4: `cout' undeclared (first use in this function)
cpp.c:4: (Each undeclared identifier is reported only once
ich denke das hat was mit headern zu tun oder?
Wär super wenn ihr mir helfen könntet!
THX
SupaSONiC

thommy
19-11-2001, 15:46
Füge anstatt stdio.h Folgendes ein:

#include <iostream>
using namespace std;

Thomas

PS: Dein Buch scheint seeehhhhr alt zu sein;)

SupaSONiC
19-11-2001, 17:04
Hi!
Das using namespace blabla dings hatte ich rausgenommen weil er da mal gemeckert hatte genauso wie das iostream, was er leider auch nid mag. Das buch ist GoTo C++ programmierung von André Willms
Hier nochmal code und fehlermeldung:

#include <iostream>
using namespace std;

int main() {
cout << "Hello World";
}

mathis@lfs:~>gcc -o lala lala.c
lala.c:1: iostream.h: No such file or directory

ps: wenn ich nur iostream nehme kommt das gleiche

jgbauman
19-11-2001, 17:06
na dann probier doch mal g++ statt gcc.
und nenn dir datei lala.C ,lala.c++ oder lala.cpp aber nicht lala.c.

SupaSONiC
19-11-2001, 17:14
Hi!
Jo danke jetzt klappts!
THX!
Hm nochmal ne kurze frage: Kann mir wer ne seite zu c++ tutorials im netz empfehlen? Deutsch wäre gut ist aber nicht dringend notwendig!
Thx
SONiC