FrozenSnake 0 Newbie Poster

I decided to try Visual Studio 2010 express Beta 2.
This code works fine on my other computer that uses Visual Studio 2009 Pro.

I am going to make a Timer that count down from a fixed time depending on foodsource. But first this code need to work :P so I can add the rest :) I wish to get this working in VS10E because I dont use VS08 on this computer.

#include <Windows.h>

const char gClassName[] = "TibiaTimer";

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_CLOSE:
		DestroyWindow(hwnd);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wc;
	HWND hwnd;
	MSG msg;

	wc.cbSize			= sizeof(WNDCLASSEX);
	wc.style			= 0;
	wc.lpfnWndProc		= WndProc;
	wc.cbClsExtra		= 0;
	wc.cbWndExtra		= 0;
	wc.hInstance		= hInstance;
	wc.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
	wc.hIconSm			= LoadIcon(NULL, IDI_APPLICATION);
	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName		= NULL;
	wc.lpszClassName	= "TibiaTimer";

	if(!RegisterClassEx(&wc))
	{
		MessageBoxA(NULL, "Window registration failed!", "FATAL ERROR", MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}
	
	hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "TibiaTimer", "TibiaTimer", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 340, 240, NULL, NULL, hInstance, NULL);
	if(hwnd == NULL)
	{
		MessageBoxA(NULL, "Window creation failed!", "FATAL ERROR", MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	ShowWindow(hwnd, nCmdShow);
	UpdateWindow(hwnd);

	while(GetMessage(&msg, NULL, 0, 0) > 0)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}

I use char-set Use Multi-Byte Character Set and have tried Unicode as well but then I get some compiler errors. But I get a lot of Linker errors in VS10E. Here is the list for anyone that wanna take a look and maybe shed some light on this.

------ Build started: Project: TibiaTimer, Configuration: Debug Win32 ------
main.cpp
main.obj : error LNK2028: unresolved token (0A000020) "extern "C" int __stdcall DestroyWindow(struct HWND__ *)" (?DestroyWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@$$FYGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2028: unresolved token (0A000022) "extern "C" int __stdcall GetMessageA(struct tagMSG *,struct HWND__ *,unsigned int,unsigned int)" (?GetMessageA@@$$J216YGHPAUtagMSG@@PAUHWND__@@II@Z) referenced in function "extern "C" int __cdecl GetMessage(struct tagMSG *,struct HWND__ *,unsigned int,unsigned int)" (?GetMessage@@$$J0YAHPAUtagMSG@@PAUHWND__@@II@Z)
main.obj : error LNK2028: unresolved token (0A000029) "extern "C" unsigned short __stdcall RegisterClassExA(struct tagWNDCLASSEXA const *)" (?RegisterClassExA@@$$J14YGGPBUtagWNDCLASSEXA@@@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A00002B) "extern "C" void __stdcall PostQuitMessage(int)" (?PostQuitMessage@@$$J14YGXH@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@$$FYGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2028: unresolved token (0A000035) "extern "C" struct HICON__ * __stdcall LoadIconA(struct HINSTANCE__ *,char const *)" (?LoadIconA@@$$J18YGPAUHICON__@@PAUHINSTANCE__@@PBD@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A00003E) "extern "C" int __stdcall TranslateMessage(struct tagMSG const *)" (?TranslateMessage@@$$J14YGHPBUtagMSG@@@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A000043) "extern "C" int __stdcall MessageBoxA(struct HWND__ *,char const *,char const *,unsigned int)" (?MessageBoxA@@$$J216YGHPAUHWND__@@PBD1I@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A000046) "extern "C" struct HWND__ * __stdcall CreateWindowExA(unsigned long,char const *,char const *,unsigned long,int,int,int,int,struct HWND__ *,struct HMENU__ *,struct HINSTANCE__ *,void *)" (?CreateWindowExA@@$$J248YGPAUHWND__@@KPBD0KHHHHPAU1@PAUHMENU__@@PAUHINSTANCE__@@PAX@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A000048) "extern "C" long __stdcall DefWindowProcA(struct HWND__ *,unsigned int,unsigned int,long)" (?DefWindowProcA@@$$J216YGJPAUHWND__@@IIJ@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@$$FYGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2028: unresolved token (0A00004C) "extern "C" int __stdcall ShowWindow(struct HWND__ *,int)" (?ShowWindow@@$$J18YGHPAUHWND__@@H@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A000050) "extern "C" long __stdcall DispatchMessageA(struct tagMSG const *)" (?DispatchMessageA@@$$J14YGJPBUtagMSG@@@Z) referenced in function "extern "C" long __cdecl DispatchMessage(struct tagMSG const *)" (?DispatchMessage@@$$J0YAJPBUtagMSG@@@Z)
main.obj : error LNK2028: unresolved token (0A000055) "extern "C" int __stdcall UpdateWindow(struct HWND__ *)" (?UpdateWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2028: unresolved token (0A000056) "extern "C" struct HICON__ * __stdcall LoadCursorA(struct HINSTANCE__ *,char const *)" (?LoadCursorA@@$$J18YGPAUHICON__@@PAUHINSTANCE__@@PBD@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall GetMessageA(struct tagMSG *,struct HWND__ *,unsigned int,unsigned int)" (?GetMessageA@@$$J216YGHPAUtagMSG@@PAUHWND__@@II@Z) referenced in function "extern "C" int __cdecl GetMessage(struct tagMSG *,struct HWND__ *,unsigned int,unsigned int)" (?GetMessage@@$$J0YAHPAUtagMSG@@PAUHWND__@@II@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall DispatchMessageA(struct tagMSG const *)" (?DispatchMessageA@@$$J14YGJPBUtagMSG@@@Z) referenced in function "extern "C" long __cdecl DispatchMessage(struct tagMSG const *)" (?DispatchMessage@@$$J0YAJPBUtagMSG@@@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall DefWindowProcA(struct HWND__ *,unsigned int,unsigned int,long)" (?DefWindowProcA@@$$J216YGJPAUHWND__@@IIJ@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@$$FYGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" void __stdcall PostQuitMessage(int)" (?PostQuitMessage@@$$J14YGXH@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@$$FYGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall DestroyWindow(struct HWND__ *)" (?DestroyWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@$$FYGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall TranslateMessage(struct tagMSG const *)" (?TranslateMessage@@$$J14YGHPBUtagMSG@@@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall UpdateWindow(struct HWND__ *)" (?UpdateWindow@@$$J14YGHPAUHWND__@@@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall ShowWindow(struct HWND__ *,int)" (?ShowWindow@@$$J18YGHPAUHWND__@@H@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall CreateWindowExA(unsigned long,char const *,char const *,unsigned long,int,int,int,int,struct HWND__ *,struct HMENU__ *,struct HINSTANCE__ *,void *)" (?CreateWindowExA@@$$J248YGPAUHWND__@@KPBD0KHHHHPAU1@PAUHMENU__@@PAUHINSTANCE__@@PAX@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall MessageBoxA(struct HWND__ *,char const *,char const *,unsigned int)" (?MessageBoxA@@$$J216YGHPAUHWND__@@PBD1I@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" unsigned short __stdcall RegisterClassExA(struct tagWNDCLASSEXA const *)" (?RegisterClassExA@@$$J14YGGPBUtagWNDCLASSEXA@@@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" struct HICON__ * __stdcall LoadCursorA(struct HINSTANCE__ *,char const *)" (?LoadCursorA@@$$J18YGPAUHICON__@@PAUHINSTANCE__@@PBD@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
main.obj : error LNK2019: unresolved external symbol "extern "C" struct HICON__ * __stdcall LoadIconA(struct HINSTANCE__ *,char const *)" (?LoadIconA@@$$J18YGPAUHICON__@@PAUHINSTANCE__@@PBD@Z) referenced in function "extern "C" int __stdcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J216YGHPAUHINSTANCE__@@0PADH@Z)
C:\development\TibiaTimer\TibiaTimer\Debug\TibiaTimer.exe : fatal error LNK1120: 26 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I wanted to attach a zip file but I wasn't allowed :P maybe the file was to big.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.