Why is there an error for this basic C++ code?

  c++

I was about to start learning C++ and I was instructed to run the code below to check if everything was working correctly. However, I keep receiving an error and I don’t know the reason for it.

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World" << endl;
    return 0;
}

The output/error it shows is..

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)

Source: Windows Questions C++

LEAVE A COMMENT