私はUbuntuでコンパイルしようとしていました。だから私はこれほど小さなプログラムを入力しました:
#include <iostream>
using namespace std;
int main(){
int cases;
cin>>cases;
return 0;
}
そして、これは多くのエラーを引き起こします:
umair@ubuntu:~/cpp$ gcc -Wall -W -Werror 2.cpp -o 1
/tmp/ccU4nAIg.o: In function `main':
2.cpp:(.text+0x10): undefined reference to `std::cin'
2.cpp:(.text+0x15): undefined reference to `std::istream::operator>>(int&)'
/tmp/ccU4nAIg.o: In function `__static_initialization_and_destruction_0(int, int)':
2.cpp:(.text+0x4d): undefined reference to `std::ios_base::Init::Init()'
2.cpp:(.text+0x5c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccU4nAIg.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
これは "C" で簡単に実行できます。しかし、「C++」での私の間違いは何ですか?