Visual Studio 2005 and OpenGL

Started by
13 comments, last by blanky 17 years, 11 months ago
That's not your WinMain function, that's your Window Procedure. Post your WinMain function, every win32 application must have one.

usually looks something like this:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int){ MSG msg; // code here return (int) msg.wParam;}
Advertisement
That must be the problem, I don't have any WinMain function.
ok i get a similar error ive been searching for hours any help. this code is copied right out oc Beginning Game Programing.. and still i get

1>------ Build started: Project: images1, Configuration: Debug Win32 ------
1>Linking...
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Documents and Settings\me\Desktop\PPG\images1\Debug\images1.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\me\Desktop\PPG\images1\images1\Debug\BuildLog.htm"
1>images1 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========


code:

#include
#include
#include

#define APPTITLE "Kon'nichi wa, BITCHES!!!!"

//Protoype
BOOL InitInstance(HINSTANCE,int);
ATOM MyRegisterClass(HINSTANCE);
LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM);

LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
char *szHello = "Kon'nichi wa, BITCHES!!!!";
RECT rt;
int x,y,n;
COLORREF c;

switch(message)
{
case WM_PAINT:
//gets the dimensions of the window
GetClientRect(hWnd, &rt);

//start drawing on device context
hdc = BeginPaint(hWnd,&ps);

//draw some text
DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);

//draw 1000 random pixels
for(int i =0 ; i <
I assume you have an "int main()" somewhere in your code to start the app. Just replace the function declaration with

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)


and it should work.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
Quote:
Windows.h is already included in a file called stdafx.h which VS created for me, I don't know why it got there but I suppose it's important.


Off-Topic: Don't create that type of project. When you create your project, in the settings window, (Where you chose 'Windows Project'), choose 'Empty Project' as well. Link to libraries with #pragma comment(lib, "mylibrary.lib") if you don't like going into the project linker settings.

This topic is closed to new replies.

Advertisement