Visual C++ express 2005 Linker errors. Help.

Started by
3 comments, last by Yann L 18 years, 4 months ago
Hi guys. I'm trying to compile a c program found in the windows game programming gurus (freakout.cpp) using visual c++ express 2005. I have downloaded the directx sdk and platform sdk and fixed a few compiling errors and now it compiles but won't link. I'm not sure if I have the directx librarys added into the compiler but I have selected the sdk and platform sdk directorys for binarys, includes and libs. I can post the source code if someone tells me the best way to do this. I really want to get started in game programming but I'm spending most of my time troubleshooting the compiler. Here's what I get when linking (sorry if I posted it incorrectly); Linking... blackbox.obj : error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced in function "int __cdecl DD_Init(int,int,int)" (?DD_Init@@YAHHHH@Z) blackbox.obj : error LNK2019: unresolved external symbol __imp__TextOutA@20 referenced in function "int __cdecl Draw_Text_GDI(char *,int,int,int,struct IDirectDrawSurface7 *)" (?Draw_Text_GDI@@YAHPADHHHPAUIDirectDrawSurface7@@@Z) blackbox.obj : error LNK2019: unresolved external symbol __imp__SetBkMode@8 referenced in function "int __cdecl Draw_Text_GDI(char *,int,int,int,struct IDirectDrawSurface7 *)" (?Draw_Text_GDI@@YAHPADHHHPAUIDirectDrawSurface7@@@Z) blackbox.obj : error LNK2019: unresolved external symbol __imp__SetTextColor@8 referenced in function "int __cdecl Draw_Text_GDI(char *,int,int,int,struct IDirectDrawSurface7 *)" (?Draw_Text_GDI@@YAHPADHHHPAUIDirectDrawSurface7@@@Z) freakout.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z) freakout.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z) freakout.obj : error LNK2019: unresolved external symbol __imp__EndPaint@8 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z) freakout.obj : error LNK2019: unresolved external symbol __imp__BeginPaint@8 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z) freakout.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__ShowCursor@4 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__GetStockObject@4 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function _WinMain@16 freakout.obj : error LNK2019: unresolved external symbol __imp__MessageBeep@4 referenced in function "void __cdecl Process_Ball(void)" (?Process_Ball@@YAXXZ) freakout.obj : error LNK2019: unresolved external symbol __imp__GetAsyncKeyState@4 referenced in function "void __cdecl Process_Ball(void)" (?Process_Ball@@YAXXZ) freakout.obj : error LNK2019: unresolved external symbol __imp__PostMessageA@16 referenced in function "int __cdecl Game_Main(void *)" (?Game_Main@@YAHPAX@Z) C:\C C++ Projects\firstvcproject\Debug\firstvcproject.exe : fatal error LNK1120: 21 unresolved externals
Advertisement
It looks like at least part of your problem is that you didn't follow all the instructions for installing the Platform SDK for use with MSVC .NET 2005 Express Edition. You're supposed to change the additional dependencies to "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" in the corewin_express.vsprops file.
I've done that now, but its'still not working, the same error messages are generated. Can I email you the code to see if you can get it to work?
Cheers.
I figured it out. This website has an excellent explanation to this problem for noobs like me.

http://205.158.110.70/ubbcgi/ultimatebb.cgi?ubb=next_topic&f=1&t=000874&go=older

Cheers
Quote:Original post by bubbamc119
I figured it out. This website has an excellent explanation to this problem for noobs like me.

You shouldn't need to do that in your case. Th linker errors you posted show that (at least) user32.lib is not linked to the project. This library doesn't need to be specifically added to the linker dependencies, because it is usually linked in by default, if the Platform SDK was correctly installed.

Same conclusion as SiCrane here, you didn't correctly install the PSDK, didn't follow the steps required to link in default libraries, or selected an incorrect project type (eg. console instead of windowed application).

This topic is closed to new replies.

Advertisement