Hello,
I tried a program from this tutorial:
http://www.win-api.de/tutorials.php?tutid=3#define STRICT
#include <windows.h>
LRESULT CALLBACK Ereignishandler(HWND, UINT, WPARAM, LPARAM);
const char Programmname[] = "WinAPI Tutorial Kapitel 2";
// später mal probieren, ob es auch mit char * statt char[] klappt
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS WndClass;
WndClass.style = CS_HREDRAW | CS_VREDRAW;
WndClass.lpfnWndProc = Ereignishandler;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInstance;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.lpszClassName = Programmname;
WndClass.lpszMenuName = 0;
(void)RegisterClass(&WndClass);
hWnd = CreateWindow(
Programmname,
"Fenstertitel",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL
);
(void)ShowWindow(hWnd, iCmdShow);
(void)UpdateWindow(hWnd);
while (GetMessage(&msg, NULL, 0, 0))
{
(void)TranslateMessage(&msg);
(void)DispatchMessage(&msg);
}
return(msg.wParam);
}
LRESULT CALLBACK Ereignishandler(HWND hWnd, UINT uInt, WPARAM wParam, LPARAM lParam)
{
switch(uInt)
{
case WM_DESTROY: { PostQuitMessage(0); return(0); }
}
return(DefWindowProc(hWnd, uInt, wParam, lParam));
}
It compiles with no problems but when trying to build the .exe, POLINK reports 13 unresolved externals:
POLINK: error: Unresolved external symbol '__imp__LoadCursorA@8'.
POLINK: error: Unresolved external symbol '__imp__LoadIconA@8'.
POLINK: error: Unresolved external symbol '__imp__GetStockObject@4'.
POLINK: error: Unresolved external symbol '__imp__RegisterClassA@4'.
POLINK: error: Unresolved external symbol '__imp__CreateWindowExA@48'.
POLINK: error: Unresolved external symbol '__imp__ShowWindow@8'.
POLINK: error: Unresolved external symbol '__imp__UpdateWindow@4'.
POLINK: error: Unresolved external symbol '__imp__TranslateMessage@4'.
POLINK: error: Unresolved external symbol '__imp__DispatchMessageA@4'.
POLINK: error: Unresolved external symbol '__imp__GetMessageA@16'.
POLINK: error: Unresolved external symbol '__imp__PostQuitMessage@4'.
POLINK: error: Unresolved external symbol '__imp__DefWindowProcA@16'.
POLINK: error: Unresolved external symbol '_main'.
POLINK: fatal error: 13 unresolved external(s).
*** Error code: 1 ***
Here's what I've tried up to now:
- compiler settings: enabled Microsoft extensions
- compiler settings: changed "calling convention" from "__cdecl" to "__stdcall"
- compiler settings: tried all 3 possibilities for "runtime library"
I found that the linker settings allow to specify "Library an object files" and the given ones are:
"kernel32.lib advapi32.lib delayimp.lib"
but there's so many libs in Pelles C's folders that I don't want to try them all...
What's wrong here?
Hans
Windows XP SP3 - Pelles C 7.00.355 - AMD Athlon 64