🔰C++のコンパイル、、、できた！

## 結論
```C++
 g++ test.cpp
```
## 読んで欲しい人
・30分前の私
・CとC++を学んでいる人
・プログラミングを教えている人

## 経緯
入社してみたい会社がC++使ってるからCやってたけどC++やるかー！って
paizaの講座を見ていてvscodeでも実行したいなと思ったので実行してみたら

```C++
Undefined symbols for architecture x86_64:
  "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
      std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in step2-2a7ed0.o
  "std::__1::ios_base::getloc() const", referenced from:
      std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in step2-2a7ed0.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in step2-2a7ed0.o
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in step2-2a7ed0.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in step2-2a7ed0.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in step2-2a7ed0.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in step2-2a7ed0.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in step2-2a7ed0.o
  "std::__1::cout", referenced from:
      _main in step2-2a7ed0.o
  "std::__1::ctype<char>::id", referenced from:
      std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in step2-2a7ed0.o
  "std::__1::locale::~locale()", referenced from:
      std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in step2-2a7ed0.o
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in step2-2a7ed0.o
  "std::__1::ios_base::clear(unsigned int)", referenced from:
      std::__1::ios_base::setstate(unsigned int) in step2-2a7ed0.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in step2-2a7ed0.o
  "___cxa_begin_catch", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in step2-2a7ed0.o
      ___clang_call_terminate in step2-2a7ed0.o
  "___cxa_call_unexpected", referenced from:
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::failed() const in step2-2a7ed0.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in step2-2a7ed0.o
  "___cxa_end_catch", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in step2-2a7ed0.o
  "___gxx_personality_v0", referenced from:
      std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in step2-2a7ed0.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in step2-2a7ed0.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::failed() const in step2-2a7ed0.o
      std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in step2-2a7ed0.o
      std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in step2-2a7ed0.o
      Dwarf Exception Unwind Info (__eh_frame) in step2-2a7ed0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```
わらわらとエラーが出てパニックになった。
落ち着いてエラー文はどこ？って探したら最後の一文を見つけられたので
```C++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
↑をググってみたら、C++のコンパイルは
```C++
 g++ test.cpp
```
というのを見つけて
あ、そういえばコンパイルする時
```C++
cc test.cpp
```
C言語をコンパイルする時のやーつでC++をコンパイルしてたことに気づいた。
CとC++がどこまでが同じ機能なのか線引きができていなかったので予期せぬトラップに
ハマってしまった。
## 今日の成果
・C++にCのコードを書いても実行されるけどコンパイル方法に違いがあることを知った。
・エラー文と向き合った。
・見つけたエラー文を調べてC++をコンパイルすることに成功した。