###実現したいこと
整数データをコンテナに保存しコンテナの要素を出力する
###エラー
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x22): 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*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x35): undefined reference to `std::istream::operator>>(int&)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x48): 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*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x8e): undefined reference to `std::istream::operator>>(int&)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0xb7): 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*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0xd6): 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*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x154): undefined reference to `std::ostream::operator<<(int)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x163): 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*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x184): undefined reference to `std::ios_base::Init::~Init()' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text+0x1b4): undefined reference to `std::ios_base::Init::Init()' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.xdata+0xc): undefined reference to `__gxx_personality_seh0' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.xdata$_ZNSt12_Vector_baseIiSaIiEED2Ev+0xc): undefined reference to `__gxx_personality_seh0' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.xdata$_ZNSt6vectorIiSaIiEED1Ev+0xc): undefined reference to `__gxx_personality_seh0' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_[_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_]+0x244): undefined reference to `__cxa_begin_catch' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_[_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_]+0x2aa): undefined reference to `__cxa_rethrow' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_[_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_]+0x2b2): undefined reference to `__cxa_end_catch' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.xdata$_ZNSt6vectorIiSaIiEE17_M_realloc_insertIJRKiEEEvN9__gnu_cxx17__normal_iteratorIPiS1_EEDpOT_+0xc): undefined reference to `__gxx_personality_seh0' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZNKSt6vectorIiSaIiEE12_M_check_lenEyPKc[_ZNKSt6vectorIiSaIiEE12_M_check_lenEyPKc]+0x4b): undefined reference to `std::__throw_length_error(char const*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIiE10deallocateEPiy[_ZN9__gnu_cxx13new_allocatorIiE10deallocateEPiy]+0x1c): undefined reference to `operator delete(void*)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIiE8allocateEyPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEyPKv]+0x29): undefined reference to `std::__throw_bad_alloc()' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIiE8allocateEyPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEyPKv]+0x39): undefined reference to `operator new(unsigned long long)' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.rdata$.refptr._ZSt3cin[.refptr._ZSt3cin]+0x0): undefined reference to `std::cin' C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nakay\AppData\Local\Temp\ccxupZUK.o:kadai12.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to `std::cout' collect2.exe: error: ld returned 1 exit status
###コード
C
1#include<iostream> 2#include<vector> 3void print_container(std::vector<int>& values); 4int main() 5{ 6 int i,n,val; 7 std::cout<<"データ数を入力してください:"; 8 std::cin>>n; 9 std::cout<<"整数デーをタ入力してください\n"; 10 std::vector<int> vals={}; 11 for(i=0;i<n;i++){ 12 std::cin>>val; 13 vals.push_back(val); 14 } 15 std::cout<<"入力されたデータ:\n"; 16 print_container(vals); 17 std::cout<<"\n"; 18 return 0; 19} 20void print_container(std::vector<int>& values) //コンテナの定義 21{ 22 int n=values.size(); 23 int i; 24 for(i=0;i<n;i++){ 25 std::cout<<values[i]<<""; 26 } 27}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。