وقتی کد رو در gcc و g++ کامپایل می کنم، به ترتیب ارور های زیر رو میگیرم:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/ccSc70b7.o: in function `__static_initialization_and_destruction_0(int, int)':
/usr/include/c++/9/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/bin/ld: /usr/include/c++/9/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
/usr/bin/ld: /tmp/ccSc70b7.o: in function `Stack::print()':
/home/reza/Dropbox/Data_struct/C++/Stack.cpp:153: undefined reference to `std::cout'
/usr/bin/ld: /home/reza/Dropbox/Data_struct/C++/Stack.cpp:153: undefined reference to `std::ostream::operator<<(int)'
/usr/bin/ld: /home/reza/Dropbox/Data_struct/C++/Stack.cpp:153: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/bin/ld: /home/reza/Dropbox/Data_struct/C++/Stack.cpp:153: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/bin/ld: /tmp/ccSc70b7.o: in function `Queue::two_to_one()':
/home/reza/Dropbox/Data_struct/C++/queue_arr2.cpp:32: undefined reference to `std::cout'
/usr/bin/ld: /home/reza/Dropbox/Data_struct/C++/queue_arr2.cpp:32: 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*)'
/usr/bin/ld: /home/reza/Dropbox/Data_struct/C++/queue_arr2.cpp:32: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/bin/ld: /home/reza/Dropbox/Data_struct/C++/queue_arr2.cpp:32: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
collect2: error: ld returned 1 exit status
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
دلیل بروز این ارور و روش رفع اون چیه؟