# Linker Error in tile-based game

This topic is 4204 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

A while back I stopped programming after encountering an error that I had no idea how to solve. In that time, I've been doing Level Design for the Source Engine and am currently working on a modification for it as a programmer and Level Desginer, however this is irelevant to the topic at hand. After this 6 month break from programming, I have forgotten everything and subsequently I've had to re-learn C++. After reading through my C++ book a few times, I'm confident to say I'm capable of programming again, and I have decided to resume the project which caused me to quit for these 6 months. Ok, so now that we've got the background sorted, I need help from you guys. I'm programming in C++ and compiling with VC++2005Express Edition. Whenever I compile my program, the .obj files are created without a problem but the linker is having trouble creating the executable. This is my build log:
------ Build started: Project: BiggerFish, Configuration: Debug Win32 ------
Compiling...
Engine.cpp
BiggerFish.obj : error LNK2019: unresolved external symbol "public: void __thiscall CEngine::SetWindowHandle(struct HWND__ *)" (?SetWindowHandle@CEngine@@QAEXPAUHWND__@@@Z) referenced in function _WinMain@16
C:\Documents and Settings\Hillam\My Documents\Visual Studio 2005\Projects\BiggerFish\Debug\BiggerFish.exe : fatal error LNK1120: 7 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Hillam\My Documents\Visual Studio 2005\Projects\BiggerFish\BiggerFish\Debug\BuildLog.htm"
BiggerFish - 8 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have checked the VC++ help files for LNK2019 and what I was given made absolutely no sense to me, so here is that help file also: http://msdn2.microsoft.com/en-us/library/799kze2z(d=ide).aspx If you need me to post my source code also then I can do that, I just didn't post it because there is no line referenced as it is a linker error. Thanks in advance, _Sauce_

##### Share on other sites
It seems you forgot to add some (engine?) library to your project dependencies.
You can add it in "Configuration Properties"/"Linker"/"Input", in the field "Additional Dependencies". Not that you might also have to add the directory where the library is in "Configuration Properties"/"Linker"/"General", to the field "Additional Library Directories".

##### Share on other sites
Quote:
 Original post by Paulius MaruskaIt seems you forgot to add some (engine?) library to your project dependencies.You can add it in "Configuration Properties"/"Linker"/"Input", in the field "Additional Dependencies". Not that you might also have to add the directory where the library is in "Configuration Properties"/"Linker"/"General", to the field "Additional Library Directories".

No, it's my own engine (sorta) from a programming book, modified, and I've linked with all the apporpriate libraries it tells me to. I'm linking with d3d8.lib, d3dx8.lib, dxerr8.lib, and libci.lib.

I had libci.lib in there to solve a warning about deprecated function relating to strcpy, but upon removing it just now to see if it's actually causing the problem, the strcopy deprecation thing doesnt reappear on recompile, so I've removed that for now.

##### Share on other sites
Nevermind, my problem has been solved by a fellow programmer, he works for the SourceForts mod.

Turns out I didn't define most of the functions in most of my classes after adding their declarations to the header file.