Problem building OpenGl code..

Hi,

Sorry for this question which should be adressed at http://nehe.gamedev.net/ but I’m having problems registering tonight.

Anyway I’m trying to build the source code from lesson 1 which leads to the following errors in Visual Express 2005. How can I solve the problem?

 
Linking...
Lesson1.obj : error LNK2019: unresolved external symbol __imp__UnregisterClassA@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__ReleaseDC@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__ShowCursor@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__ChangeDisplaySettingsA@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__SetFocus@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__SetPixelFormat@12 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__ChoosePixelFormat@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__AdjustWindowRectEx@16 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
Lesson1.obj : error LNK2019: unresolved external symbol __imp__SwapBuffers@4 referenced in function _WinMain@16
Lesson1.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
Lesson1.obj : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function _WinMain@16
Lesson1.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
.\Release/Lesson1.exe : fatal error LNK1120: 23 unresolved externals

Cheers :slight_smile:

I am guessing you have just installed Visual Express 2005? By default it can’t build win32 applications.

Ensure you have followed these steps and installed the platform SDK.

http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Thanks for your mail sqrt^-1

I have already installed the PDSK and seen some OpenGl code compile nicely - but just not the code samples from Nehe.

Thanks for your mail…

Cheers

Something like this might happen if not all the right libraries are linked, are you sure that you performed step 4 in the above link.

(sidenote: one could assume that the installer would do this automatically, but no, you have to do it manually)

Thanks guys - it now works…missed the fourth step!

Happy new year