mac gcc 编译错误 基础问题

时间:2021-10-16 03:46:30

mac gcc  Undefined symbols for architecture x86_64 "std::__1:

//

Undefined symbols for architecture x86_64:

"std::__1::locale::use_facet(std::__1::locale::id&) const", 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 Person-c78205.o

"std::__1::ios_base::getloc() const", 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 Person-c78205.o

"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:

std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std:

...

---------

//

gcc 开启使用标准c++库即可

比如:

gcc -lstdc++ Person.cpp -o Person