S
S
sddvxd2018-04-18 18:27:02
C++ / C#
sddvxd, 2018-04-18 18:27:02

Why does the compiler throw an error?

Good afternoon
I'm trying to compile files using GCC, there are no errors in the code, the compiler gives the following:

C:\Users\sddvxd\Documents\cpp>gcc *.cpp -o test.exe
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text+0x1d): undefined reference to `std::allocator<char>::allocator()'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text+0x35): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text+0x55): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text+0x5f): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text+0x88): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text+0x96): undefined reference to `std::allocator<char>::~allocator()'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.text$_ZN6ZdanieD1Ev[__ZN6ZdanieD1Ev]+0xf): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
C:\Users\sddvxd\AppData\Local\Temp\ccaHlD6i.o:func.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\Users\sddvxd\AppData\Local\Temp\ccDxpHbc.o:source.cpp:(.text+0x13): undefined reference to `std::cout'
C:\Users\sddvxd\AppData\Local\Temp\ccDxpHbc.o:source.cpp:(.text+0x18): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:\Users\sddvxd\AppData\Local\Temp\ccDxpHbc.o:source.cpp:(.text+0x35): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
C:\Users\sddvxd\AppData\Local\Temp\ccDxpHbc.o:source.cpp:(.text+0x4d): undefined reference to `std::ios_base::Init::~Init()'
C:\Users\sddvxd\AppData\Local\Temp\ccDxpHbc.o:source.cpp:(.text+0x6e): undefined reference to `std::ios_base::Init::Init()'
collect2.exe: error: ld returned 1 exit status

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2018-04-18
@sddvxd

g++ *.cpp -o test.exe

M
MiRPiX, 2018-04-26
@RSM0000

gcc *.cpp -lSDL -lstdc++
Try this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question