I am really new to C++. I am trying to compile this simple program but I get an error
#include <iostream>
int main(int argc, char** argv)
{
cout << "You have entered " << argc
<< " arguments:" << "\n";
for (int i = 0; i < argc; ++i)
cout << argv[i] << "\n";
return 0;
}
The error that I get is
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
I try to compile it as g++ file1.cpp I also tried g++ -c file1.cpp and then g++ main.exe file1.o which does not work as well. What am I doing wrong?