I have a project that I added a gtest project to, then turned the original project into a .lib project and called its main() function from a 3rd, new project. This way, I can build the test .exe with the project .exe. Except, it's not working.
These are the steps I've followed as mentioned here
Create or open a project, then create a Win32 Console Application test project for it.
Right click the test project, go to properties, and set Configuration to debug.
Go to Configuration Properties > C/C++ > General > Additional Include Directories and add the gtest includes folder.
Under Code Generation > Runtime Library, choose MDt or MTd; whatever is used by the project to be tested.
Under Linker > General > Additional Library Directories, add a reference to the folder with gtestd.lib.
Under Input > Additional Dependencies, add gtestd.lib.
Right click the test project, go to properties, and set Configuration to release, then perform steps 3 and 4.
Under Linker > General > Additional Library Directories, add a reference to the folder with gtest.lib.
Under Input > Additional Dependencies, add gtest.lib.
These are the steps I've followed for linking the test project, as mentioned here
Right click the test project, go to Build Dependencies > Project Dependencies, and add the project to be tested.
Go to Properties > C/C++ > General > Additional Include Directories and include headers from the project to test.
Under Linker > Input > Additional Dependencies, enter the .lib file of the project
Here is the problem
For some reason, the test project surprisingly works, but only in release mode. The wrapper project doesn't work in either mode, despite having the same settings as the test project. I've looked at 20 possible solutions and have yet to find one. I also tried __declspec(dllexport) in front of every method in the library project, but that doesn't do any justice. VS is fighting me tooth-and-nail.
Other stuff I tried
I don't want to change the project to build a .lib every time I need to test. So I looked into creating both a .exe and .lib from the project using a pre-link build event, but it seems to only take console commands and I couldn't figure out how to hook up the resulting .lib file from the console commands I got from another SO answer.
Here is the current .sln file with these problems. URLs are absolute: https://drive.google.com/file/d/0B6r81tGW7hODeXNpR3ROc3hYMWc/view?usp=sharing
How do I simply make a test project and wrapper project to launch a normal project (that works in both debug and release mode)?