G++ unter Linux

Geschlossen
Franziskaner - 14. Juni 2011 um 18:08
 enigma - 15. Juni 2011 um 12:54
sers Leute,

I hab ein kleines Problem bezogen auf g++

toto.cc

Code:


#include <iostream>

using namespace std; le makefile

int main()
{
char buffy[128];

cout << "Hello World!\n";
cin >> buffy;
}


In der Konsole habe ich

Code:



[Holger@ versuchC++Project]$ gcc toto.cc
toto.cc:11:4: warning: no newline at end of file
/tmp/cccVL0xC.o(.text+0x1c): In function 'main':
: undefined reference to 'std::cout'
/tmp/cccVL0xC.o(.text+0x21): In function 'main':
: undefined reference to 'std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/cccVL0xC.o(.text+0x33): In function 'main':
: undefined reference to 'std::cin'
/tmp/cccVL0xC.o(.text+0x38): In function 'main':
: undefined reference to 'std::basic_istream<char, std::char_traits<char> >& std::operator>><char, std::char_traits<char> >(std::basic_istream<char, std::char_traits<char> >&, char*)'
/tmp/cccVL0xC.o(.text+0x64): In function '__static_initialization_and_destruction_0(int, int)':
: undefined reference to 'std::ios_base::Init::Init[in-charge]()'
/tmp/cccVL0xC.o(.text+0x93): In function '__tcf_0':
: undefined reference to 'std::ios_base::Init::~Init [in-charge]()'
/tmp/cccVL0xC.o(.eh_frame+0x11): undefined reference to '__gxx_personality_v0'
collect2: ld returned 1 exit status
[jean@ EssaiC++Project]$



Ich habe keine Ahnung was all diese Fehler bedeuten, und blicke nicht mehr durch
Vielen Danke für eure Hilfe

1 Antwort

Hallo,

ich habe das selbe Problem wie Franziskaner (selbe Fehlermeldungen). Und der grund war, weil ich den Befehl

"gcc test.cpp " (gcc für C)
statt
"g++ test.cpp " (g++ für C++)

benutzt habe.

ich hoffe viele werden durch meine Antwort geholfen werden :o)
0
Treten Sie der Community bei