Monday, November 11, 2019

c++ - undefined reference to `WinMain'

I am taking a course in c++ and I've copied the code and done exactly the same as the tutor in the course did in the lecture, however when I do so I get a long error "...undefined reference to `WinMain'" and I don't know what to do.




I am using Eclipse Neon on Windows 10 (and Cygwin, I don't know if it's relevant) and this is my code:



`



#include 
#include
using namespace std;

int main() {


cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;


}
`
The code works and runs without the "#include ", but when I add this line of code the error pops up when I run it (so I guess that's where the problem is). When the tutor in the course run this code it works and prints out the text correctly.
Can someone please tell me how I get rid of this error and get this simple program to run?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...