Skip to main content
gamedev.net
🔒 Locked

WINAPI acting up

Started by CyberSlag5k Jan 18, 2005 at 4:49 PM 6 replies 600+ views
Original Post
CyberSlag5k
CyberSlag5k
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?
Without order nothing can exist - without chaos nothing can evolve.
chollida1
chollida1
what unresolved error?? A link error?? are you linking iwht the correct windows libraries, user32.lib??

Cheers
Chris
CheersChris
Mercury
Mercury
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.
Dave Hunt
Dave Hunt
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.
Randy of Neuron
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.
Sincerely,Randy Trulsonwww.NeuronGames.com
Mercury
Mercury
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.
chollida1
chollida1
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
CheersChris
CyberSlag5k
CyberSlag5k
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!
Without order nothing can exist - without chaos nothing can evolve.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.