1. 程式人生 > >mac clion ld: symbol(s) not found for architecture x86_64

mac clion ld: symbol(s) not found for architecture x86_64

自從不小心把gcc刪掉後,重新安裝在clion下編譯就出現了這個問題。

Undefined symbols for architecture x86_64:\
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:\
      _main in main.o\
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:\
      _main in main.o\
  "std::terminate()", referenced from:\
      ___clang_call_terminate in main.o\
  "___cxa_begin_catch", referenced from:\
      ___clang_call_terminate in main.o\
  "___gxx_personality_v0", referenced from:\
      _main in main.o\
      Dwarf Exception Unwind Info (__eh_frame) in main.o\
ld: symbol(s) not found for architecture x86_64\
clang: error: linker command failed with exit code 1 (use -v to see invocation)\
make: *** [main] Error 1\
 

在編譯選項的時候,將重新安裝的gcc和g++目錄重新填入

還不行的話,在終端下編譯選項新增-lstdc++