C++ Error: undefined reference to `main’

Undefined reference to main() means that your program lacks a main() function, which is mandatory for all C++ programs. Add this somewhere:

int main()
{
  return 0;
}

Leave a Comment