Sign in to follow this  
DarkCybo1

Problem compiling Win32 under VS2005 Express

Recommended Posts

The code:
#include <windows.h>

LRESULT CALLBACK WindowProc( HWND hWnd, unsigned int message, WPARAM wP, LPARAM lP )
{

	return ::DefWindowProc( hWnd, message, wP, lP );

}

int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int cmdnum )
{

	HWND wnd;
	WNDCLASSEX wc;

	ZeroMemory( &wc, sizeof( WNDCLASSEX ) );

	wc.cbSize = sizeof( WNDCLASSEX );
	wc.style = CS_VREDRAW | CS_HREDRAW;
	wc.hInstance = hInst;
	wc.lpfnWndProc = (WNDPROC) WindowProc;
	wc.hbrBackground = (HBRUSH) COLOR_WINDOW;
	wc.hCursor = LoadCursor( NULL, IDC_ARROW );
	wc.lpszClassName = L"BasicWin32App";

	::RegisterClassEx( &wc );

}

The build errors: BasicWin32.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z) BasicWin32.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function _WinMain@16 BasicWin32.obj : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function _WinMain@16 I've already downloaded and installed the Windows Platform SDK, and I've added the lib/include directories for the Platform SDK to my project. What's the problem here?

Share this post


Link to post
Share on other sites
You've told it where to find the .lib files, but have you told it what .lib files it should be linking with?

There's an XML file you can edit (corewin_express.vsprops) to add the .lib files to the list of additional dependencies that are specified for the Win32 project type (so that whenever you create a Win32 project, it'll have the right libraries linked in).
It's explained in this forum post.

Alternatively, you could just switch to VC++ 2008 Express, which comes with the Platform SDK already packaged up to work with it.

John B

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this