0

I run:

#include <iostream>
using namespace std;

int main(){
    cout << "Hello world"<<endl;
    return 0;
}
g++ hello.cpp

Error:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It's just a simple C++ program, I don't know what's wrong with my environment seeting. Could you please help me with this? Thanks!

Peter - Reinstate Monica
  • 15,048
  • 4
  • 37
  • 62
Gloria1009
  • 61
  • 1
  • 6

0 Answers0