Jump to content
  • Advertisement
Sign in to follow this  
CyberSlag5k

WINAPI acting up

This topic is 4998 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

I'm trying to just get a simple window open and having problems. This simple code (and I'd like to get this code working rather than using something different) gets me an unresolved external error:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{

return 0;
}

Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
It's most likely an external error saying it can't find main. Make a win32 application instead of a console application. I could be wrong, but that'd be my first guess.

Share this post


Link to post
Share on other sites
It is very likely that you have created a "console" application, rather than a "Windows" application. The linker is probably looking for a function called "main". Check your project/compiler options and make sure it's creating a windows application. This will differ based on what compiler you are using.

Share this post


Link to post
Share on other sites
Check your lib and include paths under your project settings. Anytime you get an unresolved external means that it can not find the file needed to link with your program. Since the only thing you include is Windows.h, I would checking to see that you installed the compiler correctly. The lib and include paths have to point to the directories where the .lib / .obj and .h / .hpp files that come with the compiler are. I hope this dosen't confuse you.

Share this post


Link to post
Share on other sites
Quote:
Original post by Randy of Neuron
Check your lib and include paths under your project settings. Anytime you get an unresolved external means that it can not find the file needed to link with your program. Since the only thing you include is Windows.h, I would checking to see that you installed the compiler correctly. The lib and include paths have to point to the directories where the .lib / .obj and .h / .hpp files that come with the compiler are. I hope this dosen't confuse you.


He's not using any external functions though, the only reason I could see that giving an unresolved external is if it's looking for main and not WinMain, which I'm almost positive is the case.

Share this post


Link to post
Share on other sites
Wow its your lucky day, it looks like 4 or 5 of us all jumped on that and told you exactly the same thing, shouldn't be too hard to track down:)

Cheers
Chris

Share this post


Link to post
Share on other sites
Quote:

Wow its your lucky day, it looks like 4 or 5 of us all jumped on that and told you exactly the same thing, shouldn't be too hard to track down:)

Cheers
Chris


Heh, my lucky day indeed. Yeah that was it, I was making a console application. Switching to a windows app cleared it right up.

Thanks everyone!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!