Unresolved Extrernal symbol problem.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
i am back again to ask another question.

i used this tutorial http://msdn.microsoft.com/en-us/library/bb384843.aspx" target="_blank
here
and i followed each step to the note. but im getting this :

error LNK2019: unresolved external symbol "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) referenced in function _WinMain@16
the only parts of the code i have edited are the application title and adding buttons to the msgboxs

<div style="color:Black;background-color:White; <pre>
#include <Windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>

<span style="color:Green; //ttrying to fix LINKING problem. some websote said to add these but does not help.

#pragma comment(lib, <span style="color:#A31515; "Kernel32.lib")
#pragma comment(lib, <span style="color:#A31515; "User32.lib")



HWND hWnd;
HINSTANCE hInst;

<span style="color:Green; //CLASS NAME

<span style="color:Blue; static TCHAR szWindowClass[] = _T(<span style="color:#A31515; "Win32app");

<span style="color:Green; //Title Name
<span style="color:Blue; static TCHAR szTitle[] = _T(<span style="color:#A31515; "TGFB (ALPHA) 1.1 by LdaXy");

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

<span style="color:Blue; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstace, LPSTR lpCmdLine, <span style="color:Blue; int nCmdShow)
{
WNDCLASSEX wc;

wc.cbSize = <span style="color:Blue; sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = szWindowClass;
wc.hIconSm = LoadIcon(wc.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));

<span style="color:Green; //check if we can register WNDCLASSEX

<span style="color:Blue; if (!RegisterClassEx(&wc))
{
MessageBox(NULL, _T(<span style="color:#A31515; "Failed to register WNDCLASSEX!"), _T(<span style="color:#A31515; "TGFB.EXE"), MB_OK | MB_ICONSTOP);
<span style="color:Blue; return 1;
}

hInst = hInstance;

<span style="color:Green; //Create the window

HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 500, 500, NULL, NULL, hInstance, NULL);

<span style="color:Blue; if (!hWnd)
{
MessageBox(NULL, _T(<span style="color:#A31515; "Failed to create window!"), _T(<span style="color:#A31515; "TGhWndFB.EXE"), MB_OK | MB_ICONSTOP);
<span style="color:Blue; return 1;
}

ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

MSG msg;

<span style="color:Green; //messages to the window

<span style="color:Blue; while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

<span style="color:Blue; return (<span style="color:Blue; int)msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, LPARAM lParam, WPARAM wParam)
{
HDC hDC;
PAINTSTRUCT ps;
TCHAR Message[] = _T(<span style="color:#A31515; "A SIMPLE WINDOW PROGRAM FOR NOW!");

<span style="color:Blue; switch(message)
{
<span style="color:Blue; case WM_PAINT:
BeginPaint(hWnd, &ps);

TextOut(hDC, 255, 255, Message, _tcslen(Message));

EndPaint(hWnd, &ps);
<span style="color:Blue; break;
<span style="color:Blue; case WM_DESTROY:
PostQuitMessage(0);
<span style="color:Blue; break;
<span style="color:Blue; default:
<span style="color:Blue; return DefWindowProc(hWnd, message, wParam, lParam);
}

<span style="color:Blue; return 0;
}
[/code]
<br/>
any ideas?
<hr class="sig Dtex-Masaki is here to help, and get help ?.e

View the full article
 
Back
Top