1

I installed gcc-11 with home-brew (brew install gcc) and tried to compile a simple cpp file with gcc-11 -o main main.cpp but I get the following error:

Undefined symbols for architecture x86_64:  
  "__ZNSt8ios_base4InitC1Ev", referenced from:    
      __Z41__static_initialization_and_destruction_0ii in ccsPh29E.o. 
  "__ZNSt8ios_base4InitD1Ev", referenced from:
      __Z41__static_initialization_and_destruc tion_0ii in ccsPh29E.o. 
  "__ZSt4cout", referenced from:  
      _main in ccsPh29E.o. 
  "__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc", referenced from:  
      _main in ccsPh29E.o. 
ld: symbol(s) not found for architecture x86_64 
collect2: error: ld returned 1 exit status  

How can I fix it? Thanks

gabikripka
  • 43
  • 4

0 Answers0