Re: [Debian] gcc problem
>> mt.C:32: `cout' undeclared (first use this function)
> C++ also.
Ja. .C ist C++
>> a) Welche Lib beinhaltet die cout-funktion ?
Darum muss man sich normalerweise nicht kümmern... (wenn man g++ nimmt :-)
> [...] Die c++-Standardbibliothek
libstdc++
> iostream(.h) bindest du eh ein?
Vermutlich nicht, denn da wird cout definiert.
1> cat hello.C
#include <iostream>
int main(void)
{
cout << "Hello, World!" << endl;
return 0;
}
1> gcc hello.C
/tmp/cczgwA1o.o: In function `main':
/tmp/cczgwA1o.o(.text+0xa): undefined reference to `endl(ostream &)'
/tmp/cczgwA1o.o(.text+0x17): undefined reference to `cout'
/tmp/cczgwA1o.o(.text+0x1c): undefined reference to `ostream::operator<<(char const *)'
/tmp/cczgwA1o.o(.text+0x27): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status
1> gcc hello.C -lstdc++
1> ./a.out
Hello, World!
1> g++ hello.C
1> ./a.out
Hello, World!
--
"I'm working on it." <http://www.psyche.kn-bremen.de/>
--
-----------------------------------------------------------
Um sich aus der Liste auszutragen schicken Sie bitte eine
E-Mail an debian-user-de-request@lehmanns.de die im Subject
"unsubscribe <deine_email_adresse>" enthaelt.
Bei Problemen bitte eine Mail an: Jan.Otto@Lehmanns.de
-----------------------------------------------------------
923 eingetragene Mitglieder in dieser Liste.
Reply to: