I am trying to compile this little program in file demo.cpp
by gcc demo.cpp
,
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}
It does not do so successfully. I get Undefined symbols for architecture arm64:
,
This seems like pretty popular error but people are getting it on way more complicated programs. Note that it works if I comment the cout line. I am not sure exactly what am I doing wrong here. gcc -v
returns,
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin