Question
My main.cpp: https://imgur.com/a/wiARur9 My C++ file is fine in Xcode but produces the following error in g++: gcc -std=c++11 main.cpp -o main.exe Undefined symbols for
My main.cpp: https://imgur.com/a/wiARur9
My C++ file is fine in Xcode but produces the following error in g++:
gcc -std=c++11 main.cpp -o main.exe
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::ctype
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios
"std::logic_error::logic_error(char const*)", referenced from:
std::length_error::length_error(char const*) in main-914431.o
"std::length_error::~length_error()", referenced from:
std::__1::__throw_length_error(char const*) in main-914431.o
"std::__1::basic_string
std::__1::basic_string
"std::__1::basic_string
std::__1::basic_istream
"std::__1::basic_string
_main in main-914431.o
std::__1::ostreambuf_iterator
"std::__1::basic_istream
std::__1::basic_istream
"std::__1::basic_ostream
std::__1::basic_ostream
"std::__1::basic_ostream
std::__1::basic_ostream
"std::__1::cin", referenced from:
_main in main-914431.o
"std::__1::cout", referenced from:
_main in main-914431.o
"std::__1::ctype
std::__1::ctype
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate(unsigned int) in main-914431.o
"std::terminate()", referenced from:
___clang_call_terminate in main-914431.o
"typeinfo for std::length_error", referenced from:
std::__1::__throw_length_error(char const*) in main-914431.o
"vtable for std::length_error", referenced from:
std::length_error::length_error(char const*) in main-914431.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"operator delete(void*)", referenced from:
std::__1::_DeallocateCaller::__do_call(void*) in main-914431.o
"operator new(unsigned long)", referenced from:
std::__1::__libcpp_allocate(unsigned long, unsigned long) in main-914431.o
"___cxa_allocate_exception", referenced from:
std::__1::__throw_length_error(char const*) in main-914431.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in main-914431.o
std::__1::basic_istream
std::__1::basic_ostream
"___cxa_end_catch", referenced from:
std::__1::basic_istream
std::__1::basic_ostream
"___cxa_free_exception", referenced from:
std::__1::__throw_length_error(char const*) in main-914431.o
"___cxa_rethrow", referenced from:
std::__1::basic_istream
"___cxa_throw", referenced from:
std::__1::__throw_length_error(char const*) in main-914431.o
"___gxx_personality_v0", referenced from:
_main in main-914431.o
std::__1::__deque_base
std::__1::__deque_base
std::__1::__deque_base
std::__1::__deque_base
std::__1::allocator
std::__1::__split_buffer
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started