正しくコンパイル出来ているかと言われ
C++のコンパイルについて更に調べた所、
拡張機能のcode runnnerのjsonファイルに
「*.c」「*.cpp」を追記しなければならない
という事が分かりました。ありがとうございます。
(
https://qiita.com/kkml_4220/items/210d8bad8a569b8f8194)
: undefined reference to `CSample::set(int)'
: undefined reference to `CSample::get()'
上記のエラーは解消できましたが、
: ld returned 1 exit status
はまだ表示されています。
ビルド時のコマンドというのは、
以下の部分で宜しかったでしょうか?
if ($?) { g++ main.cpp *.cpp -o main } ; if ($?) { .\main }
一応、実行結果を全て貼り付けさせて頂きます
PS C:\Users\Lenovo\OneDrive\デスクトップ\C> cd "c:\Users\Lenovo\OneDrive\デスクトップ\C\" ; if ($?) { g++ main.cpp *.cpp -o main } ; if ($?) { .\main }
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Lenovo\AppData\Local\Temp\ccye7doC.o:main.cpp:(.text+0x0): multiple definition of `main'; C:\Users\Lenovo\AppData\Local\Temp\cchmCj2B.o:main.cpp:(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
宜しくお願いいたします。