question: where are the linker options :D?
¬_¬
VC++6.0 unresolved external symbol _main?
Project, settings, link.
---visit #directxdev on afternet <- not just for directx, despite the name
thanks a lot, your probably annoyed by now.. but after changing "console" to "windows", i now get:
--------------------Configuration: Window - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Window.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Window.exe - 2 error(s), 0 warning(s)
¬_¬
--------------------Configuration: Window - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Window.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Window.exe - 2 error(s), 0 warning(s)
¬_¬
April 24, 2002 01:48 PM
Why dont you just create a new project, a Win32 Application project. Make it empty and just add you files to it. That way you know the project settings are correct and you can isolate the problem to your code. It will also be a lot quicker than manually changing the settings if you are not experienced in such matters.
Now that you have the Windows app, do you have a (correctly defined) WinMain function?
---visit #directxdev on afternet <- not just for directx, despite the name
a) I''ve tried making a win32 application (yes yes i tried it many times with it not being a console app..) and it still gives me the same errors (:|)
b) I think so. ahha. I think its correctly defined, because its what many tutorials have:
#include <windows.h>
#define WNDCLASSNAME "wndclass"
HDC hdc;
HWND hwnd;
int swidth = 640;
int sheight = 480;
bool quit = false;
/*
---------------------
The event handler
---------------------
*/
LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_CLOSE:
{
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd, msg, wparam, lparam);
}
/*
---------------------
WinMain
---------------------
*/
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int nshowcmd)
{
MSG msg;
WNDCLASSEX ex;
ex.cbSize = sizeof(WNDCLASSEX);
ex.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC;
ex.lpfnWndProc = WinProc;
ex.cbClsExtra = 0;
ex.cbWndExtra = 0;
ex.hInstance = hinstance;
ex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
ex.hCursor = LoadCursor(NULL, IDC_ARROW);
ex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
ex.lpszMenuName = NULL;
ex.lpszClassName = WNDCLASSNAME;
ex.hIconSm = NULL;
RegisterClassEx(&ex);
// create the window
hwnd = CreateWindowEx(NULL,
WNDCLASSNAME,
"Window",
WS_OVERLAPPEDWINDOW,
0, 0,
swidth, sheight,
NULL,
NULL,
hinstance,
NULL);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
// the message loop
while(!quit)
{
if(GetAsyncKeyState(VK_ESCAPE))
quit = true;
if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
{
if(msg.message == WM_QUIT)
quit = true;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.lParam;
}
¬_¬
b) I think so. ahha. I think its correctly defined, because its what many tutorials have:
#include <windows.h>
#define WNDCLASSNAME "wndclass"
HDC hdc;
HWND hwnd;
int swidth = 640;
int sheight = 480;
bool quit = false;
/*
---------------------
The event handler
---------------------
*/
LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_CLOSE:
{
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd, msg, wparam, lparam);
}
/*
---------------------
WinMain
---------------------
*/
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int nshowcmd)
{
MSG msg;
WNDCLASSEX ex;
ex.cbSize = sizeof(WNDCLASSEX);
ex.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC;
ex.lpfnWndProc = WinProc;
ex.cbClsExtra = 0;
ex.cbWndExtra = 0;
ex.hInstance = hinstance;
ex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
ex.hCursor = LoadCursor(NULL, IDC_ARROW);
ex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
ex.lpszMenuName = NULL;
ex.lpszClassName = WNDCLASSNAME;
ex.hIconSm = NULL;
RegisterClassEx(&ex);
// create the window
hwnd = CreateWindowEx(NULL,
WNDCLASSNAME,
"Window",
WS_OVERLAPPEDWINDOW,
0, 0,
swidth, sheight,
NULL,
NULL,
hinstance,
NULL);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
// the message loop
while(!quit)
{
if(GetAsyncKeyState(VK_ESCAPE))
quit = true;
if(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
{
if(msg.message == WM_QUIT)
quit = true;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.lParam;
}
¬_¬
April 24, 2002 02:20 PM
I usually define WinMain like this:
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow )
I dont know if it is more correct to say PASCAL rather than WINAPI.
And I define my message handler like:
LRESULT WINAPI WinProc(
Give it a shot eh?
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow )
I dont know if it is more correct to say PASCAL rather than WINAPI.
And I define my message handler like:
LRESULT WINAPI WinProc(
Give it a shot eh?
What if you create a "simple" application and paste your source into that?
And please wrap your code into "source" tags.
And please wrap your code into "source" tags.
---visit #directxdev on afternet <- not just for directx, despite the name
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement