I installed gcc by brew on Mac OS mojave, but both of gcc and g++ are not working.
I tried compile below simple code by g++ but I got error messages.
This program can be compiled correctly by default clang, so I am wondering there is any library link error. But I am not sure.
I got same error in the case of gcc.
#include <iostream>
using namespace std;
int main(){
int i;
cin >> i;
cout << i * 2 + 1 << endl;
}
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd Undefined symbols for architecture x86_64: "___cxa_atexit", referenced from: __static_initialization_and_destruction_0(int, int) in ccEBCemd.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status
Thank you.