Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

Eclipse problem: undefined reference to `WinMain@16'

This topic is 2518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First I download Eclipse for C++. I then download and install MinGW. After that I create a C++ project that is using the MinGW tool chain and add a cpp file to it. Finally I type this into the cpp file:





#include<"windows.h">

int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
return 0;
}





Then I try to build it but I get this error:

C:\MinGW\msys\1.0\src\mingwrt/../mingw/main.c:73: undefined reference to `WinMain@16'[/quote]

I think this means that it can't find the winmian function but I clearly defined it. Any idea what the problem is?

Share this post


Link to post
Share on other sites
Advertisement

Did you set UNICODE as a define in your compiler settings, by any chance?


Not that I'm aware of. I literally did the exact steps which I gave. Nothing more and nothing less. I also tried it on a computer at school and had the same issue. I'm sure if you were to repeat those step you would get the same error.

Share this post


Link to post
Share on other sites
Your #include of windows.h looks suspicious - angle brackets as well as quotes. You should only use angle brackets.

Share this post


Link to post
Share on other sites

Your #include of windows.h looks suspicious - angle brackets as well as quotes. You should only use angle brackets.


No, that was just a mistake in my syntax while writing this post. However, I was able to get it to compile but it appears to be a bug in eclipse. I have to go in to the run configurations and double click C/C++ Application to create a new run configuration. After that I have to first attempt to run it and it will give me an error but then after I can build it. I then have to manually set the exe file I built and when I try to run it again everything works as it is suppose to. It does not make any sense to me. Is this a bug or am I misunderstanding something?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!