Excellent, people are always having trouble with these so good 1 for providing fixes.
Definately deserves a sticky but I think this may belong in the c++ section.
Visual Studio Linker Errors
When I was finishing up my Black Ops trainer and started compiling the release I came across a few errors that I haven't seen before. After doing online searches for awhile I came to find out that Microsoft has a bug in their linker system. The linker system is suppose to tell the compiler where it can find the needed resources and references when compiling the executable or DLL. The errors I came across were
LNK2001 and 2019 are pretty much the same thing from what I could find. From MSDN:
I noticed while doing my searching that a lot of people ended up using the debug version as the release. I personally think that is a bad idea since there are other tools that are working with debug mode to help find problems with the program. I saw the other day someone on these forums had this exact same problem. I decided to write up this tutorial on how to resolve these issues if you come across it. I will be using my Black Ops project for this trainer and show how I resolved the problem.unresolved external symbol 'symbol' referenced in function 'function'
Error LNK2028 & LNK2019
When I first attempted to compile my release program it returned 5 errors (multiple 2028 &2019. Also an Error LNK1120 but it's fixed with these steps).
For this problem you need to open your Configuration Manager (Build->Configuration Manager, or ALT+F7 with the current focus window being Solution Explorer or your coding). In the Configuration Properties there will be a subcategory C/C++. Click on the arrow and click on the Optimization subcategory. There will be an option at the bottom called Whole Program Optimization as seen in the picture below
You need to select the Yes(/GL) option. What this does is let the compiler optimize all your code for you instead of you specifying specific functions to inline.
Once that was complete I cleaned and recompiled the program and got three errors
The compiler was unable to find the GetWindowThreadProcessID and FindWindowW definitions which are defined in WinUser.h. But WinUser.h is already defined in the <Windows.h> header so I looked up the library that these two functions used at MSDN and both were declared in user32.lib. From that it looked like user32.lib isn't declared in my project which I thought was weird because it should of been. I opened my Configuration Manager back up and went to Configuration Properties->Linker->Input. From here the first row should be Additional Dependencies. Click on the drop down and click Edit. This will open the window and show the library's you called and the bottom shows Inherited Libraries. I thought that meant they were already declared in my project, but for some reason they weren't. So I added use32.lib to the top text box.
From here i clicked ok, accept, ok, and recompiled my program error free.
Hopefully this will help anyone having these or similar issues. Before anyone asks I know I could have just told you to do both the Optimization and Linker Input steps at the same time, but I wanted to show them separately in case someone comes across one or the other and explain why it's happening.
To the Admin/Moderators: I posted in this section since were not permitted to post in the tutorials section and this looked like the next best section to post it. If it isn't then I apologize.
Another option would be
Pleasant tutorialCode:#pragma comment (lib, "user32.lib")
Thanks, but somehow only the one error (LNK2019) is fixed
I followed the other one added user32.lib but somehow nothing changed
Thread has been moved to the C/C++ section and is stickied.
I still gt a error in the d3d9dev.cpp it say couldnt open file "Hacks.h" -_- anyone can help me?