Code coverage error (No binaries were instrumented) - c++

Problem:
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
I'm attempting to use the code coverage function but it returns this error:
Empty results generated: No binaries were instrumented. Make sure the
tests ran, required binaries were loaded, had matching symbol files,
and were not excluded through custom settings. For more information
see http://go.microsoft.com/fwlink/?LinkID=253731
My .coverage file is full of non-sense, starting with "PCHÿ". I thought my problem looked similar to this one: Issue with Code Coverage in VS 2012, but deleting the .suo file and running Visual Studio in admnistrator didn't solve anything.
How to replicate:
1) Create new empty project "MyProject"
2) Add new file "Calculator.hpp"
#pragma once
class Calculator
{
public:
int add(int a, int b);
int sub(int a, int b);
};
3) Add new file "Calculator.cpp"
#include "Calculator.hpp"
int Calculator::add(int a, int b)
{
return a + b;
}
int Calculator::sub(int a, int b)
{
return a - b;
}
4) Add new file main.cpp
#include "Calculator.hpp"
#include <iostream>
using std::cout;
int main()
{
Calculator calc;
std::cout << calc.add(5, 11) << std::endl;
std::cout << calc.add(11, 1) << std::endl;
return 1;
}
5) Build solution. (0 errors)
6) Add new test project to solution as explained here: https://msdn.microsoft.com/en-us/library/hh419385.aspx#objectRef:
Add new Native Unit Test Project to solution "CalculatorUnitTest"
Add "main.obj" and "Calculator.obj" to Linker/Input/Additional Dependencies of "CalculatorUnitTest"
Add path to obj files to Linker/General/Additional Library Directories of "CalculatorUnitTest". (In my case: D:\JF\Programming\Tests\MyProject\MyProject\Debug)
Add the header directory of "MyProject" to VC++ Directories/Include Directories. (In my case: D:\JF\Programming\Tests\MyProject\MyProject).
7) Replace code in "unittest1.cpp" with:
#include "stdafx.h"
#include "CppUnitTest.h"
#include <Calculator.hpp>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace CalculatorUnitTest
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod1)
{
Calculator calc;
Assert::AreEqual(5, calc.add(2, 3));
}
};
}
8) Build solution (0 errors, TestMethod1 appear in Test Explorer)
9) Right-click TestMethod1, "Run Selected Tests" (Test successfully passes)
10) Right-click TestMethod1, "Analyze Code Coverage for Selected Tests" (Code coverage fails).
At D:\JF\Programming\Tests\MyProject\Debug, I have both my MyProject.exe and MyProject.pdb with the CalculatorUnitTest.dll.

First of all, I am not sure if Visual Studio 2015 (C++) supports ".exe" type project for the unit test. But you are using ".obj" directly from your project. You need to place ".pdb" file in the same folder.
I created a static library project and added the unit test. Same problem on my environment.

Future here. Same problem, except my test target is a Static Library project in the same Solution.
MyLib - Code that will be tested.
MyLibTests - Project containing the tests.
Solution contains both projects.
MyLibTests has project Reference to MyLib.
<OutDir> (in .vcxproj) aka Output Directory aka $(OutDir) identical in both projects. (My value <OutDir>$(SolutionDir)$(Configuration)_$(Platform)\</OutDir>)
On your test project (MyLibTests), go
Properties
Select [Debug|platform]
Linker
Debugging
Generate Debug Info = Optimize for debugging /DEBUG
Mine was initially set for /DEBUG:FASTLINK.
Via this social MSDN post I figured it had something to do with the PDB, because MSDN (aka now "learn.microsoft.com") said this is an important step in several places, and I assume PDB are used trace calls, I assume using DbgHelp.dll.
And this sort of checklist modified from another social MSDN post:
Test project References properly set (MyLib.lib is in the same Solution as MyLibTests.dll)
Build order/dependency set/verified.
I also have Autorun on Build.
Rebuild (this should rebuild dependencies).
made sure all test were run(all test run successful)
not using optimisation (Profile Guided/Instrumentation etc).
<OutDir> aka Ouput directory should be the same, where both MyLibrary.lib/dll/exe ends up with their MyLibrary.pdb since PDB paths are linked in the exe/dll.
not using a runsettings file
Unload all other projects other than affected ones

Related

C++Builder11: How to unit test with googletest?

Until recently I've used C++Builder 10.2 for a project, and I had begun to use DUnitX to add some unit tests for the project.
Now I have upgraded to C++Builder 11.2, and found that DunitX is no longer supported for C++Builder when using this version. Instead, Embarcadero recommends to use DUnit or Googletest.
On further research, it seems that Googletest cannot be used with the classic compiler (but I'm not actually interested in using the pre-C++11 classic compiler), but also that DUnit cannot be used when targeting the Firemonkey framework, and that DUnit (1) is unmaintained and (2) does not work well with the Clang-based compiler.
I'm interested in using googletest because I have already used both, googletest and googlemock, on less niche platforms than C++Builder such as Linux/GCC, Apple/Clang and Windows/MinGW-w64. I am aware that the googletest project itself refuses to accept build files or patches for C++Builder because they do not want to spend effort to support niche compilers (see e.g. here, here, and here).
I'm happy to learn that some patched version of googletest is currently available for C++Builder through the GetIt package manager, even though it is not clear who has actually made that patch, and although I realize that Embarcadero may remove googletest from the GetIt package manager an any moment.
I've found two blog posts explaining how to install googletest in C++Builder and how to use it, however, I cannot successfully follow the second blog post when it comes to point 6, which reads
In your project group create a new windows64 bit VCL console application. Set this to use the debug settings (this allows you to debug code that doesn’t pass a unit test).As well as the files you want to test and the files containing the testing code you need to add to the project the library file …GT2021.09\cbuilder\lib\Win64\Debug\gtest.a.
I'm not sure how I am supposed to "add to the project the library file". I've tried to
copy the gtest.a and gmock.a files into the project directory and then
right-click on the project name in the "Projects" view of the IDE and select "Add...", then change file type to "static libraries", then select gtest.a and repeat with gmock.a.
Here I've gone ahead and have already added gmock.a because I have experience with googlemock and envision that its additional matchers and mock class generators will help me writing tests.
When I compile a simple test project that does not actually perform any tests, everything compiles and links fine, but when I execute the resulting command line program, then it fails with exit code (errorlevel) -1073741819 and produces no output. This does not happen if I comment all usages of googletest out.
The simple test project which fails during execution consists only of
#include <gtest/gtest.h>
#include <vcl.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
which should cause googletest to print that 0 tests were executed, but instead it crashes as described. When replacing the two lines in main with a simple printf, which does not use googletest, but leaving all includes unaltered and without altering the project with regard to libraries, it works fine (the new printf prints something) but of course cannot perform any tests.
How to fix this?
One more observation: When adding the static libraries to the project as described above, I get a notification message box from the IDE, saying "One or multiple lines were too long and have been truncated". I have no idea how this message could make sense with regard to adding a static library to the project. It seems however, that this is not an error, and the linker actually uses the static libraries when linking.
The main problem here was the inclusion of the gmock.a library as it was compiled by the GetIt googletest package. This gmock project and basically all other gmock projects in the GetIt package are broken and need to be repaired before using them. I may post more details about this in a future topic. The gmock.cbproj project as distributed by GetIt, e.g., includes the unrelated source file googletest\samples\sample8_unittest.cc, among other errors.
A simple method to use googletest with C++Builder 11.2, which is based on the blog posts by Cigol, but which does not require to copy include files and library files:
When installing googletest with the getit package manager, the IDE automatically opens a group project Googletest.groupproj and compiles two of the contained projects (gtest and gtest_main) for the Windows 64 bit platform in "Release" mode. Furthermore, all other project files in the Googletest project group are modified probably because they have been updated from an earlier C++Builder version and want to be saved when closing the IDE.
There is no need to compile googletest in "Debug" mode, one would need that only for debugging the unit testing framework itself.
Next, create a new VCL Windows 64 bit console application to start using googletest:
File -> New -> "Console Application - C++Builder"
Source Type: C++, Target Framework: Visual Component Library, [OK]
Add Target Platform Windows 64-Bit in the "Projects" view (right-click on Target Platforms).
Delete Target Platform Windows 32-Bit.
Save all in a dedicated directory:
File -> Save All
Create a new folder, e.g. MyUnitTests.
Place project file as e.g. MyUnitTests.cbproj into that folder.
Rename File1.cpp to MyTestsMain.cpp and store in that folder
This creates a C++ source file MyTestsMain.cpp with some includes and an empty main function:
#include <vcl.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
}
For convenience, googletest provides a library gtest_main.a which only contains a main function that one can use to execute all unit tests compiled into an executable. By linking against the gtest_main.a library, users can avoid writing their own main function and concentrate on only writing test code. But since the C++Builder wizard has already created a main function, one can as well fill the generated main function with the necessary boilerplate code (only two lines are required, compare against the googletest main function in C:\Users\yourLogin\Documents\Embarcadero\Studio\22.0\CatalogRepository\GoogleTest-2021.09\googletest\src\gtest_main.cc) and add the gtest.h include directive:
#include <gtest/gtest.h>
#include <vcl.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Trying to build this project fails because the gtest/gtest.h include file is not found. This can be fixed in Project -> "Options..." -> Building -> C++ Shared Options -> "Include path": After selecting "All configurations - All platforms" in the drop-down list "Target", add the following entry to "Include path":
$(BDSCatalogRepository)\GoogleTest-2021.09\googletest\include
Using the variable $(BDSCatalogRepository) avoids machine- and developer-specific absolute PATHs. Save the changed project settings with File -> "Save all". Trying again to build this project now fails because of different errors, which is progress! The errors now are "Unresolved external"s, which means we have to tell the project to link against gtest.a and where to find it. Linking against gtest.a can be done by adding a pragma to the top of the file containing the main function:
#pragma comment(lib,"gtest")
#include <gtest/gtest.h>
#include <vcl.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Where to find the library can be configured in Project -> "Options..." -> Building -> C++ Shared Options -> "Library path": Again first select "All configurations - All Platforms", then add the following entry to "Library path":
$(BDSCatalogRepository)\GoogleTest-2021.09\cbuilder\lib\$(Platform)\Release
After File -> "Save All", a new, clean build generates different "Unresolved external"s, progress! This time, symbols from the standard C++ library are missing, which can be fixed via Project -> "Options..." -> Building -> C++ Linker, again for Target "All configurations - All platforms", check the checkbox "Link with Dynamic RTL, Windows...". After another File -> "Save All", a clean build succeeds and executing the generated Win64\Debug\MyUnitTests.exe generates this output:
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[ PASSED ] 0 tests.
One can now add tests to the test project. Tests can be added to the source file which contains the main function or to different, topic-specific source files. I'll add two tests in new files for demonstration:
In the "Projects" view, right click on the current project, which is confusingly named "MyUnitTest.exe" in the project view with an ".exe" extension instead of a project file extension, then select "Add new..." -> Unit in the popup menu. "Unit" here is C++Builder's language for a pair of one source and one header file, and is not necessarily related to unit testing.
The new files are initially named "Unit1.cpp" and "Unit1.h" but can be renamed when doing File -> "Save All". I name this first test file to "SelfContainedTest.cpp" because its test will be self-contained. Add the following code to the .cpp file after the IDE-Generated boilerplate:
#include <gtest/gtest.h>
TEST(SelfContained, Addition) {
EXPECT_EQ(3, 1+2);
EXPECT_GT(3, 2+2);
}
Rebuilding succeeds, execution reveals that the second EXPECT fails as it should, the number 3 is in fact not greater than the sum 2+2. Fix if you like.
In a second test, I want to test non-GUI methods of an existing VCL form. In a real-world scenario, the GUI project and my test project would be part of the same project group and live in the same directory or below the same parent directory, and I would add the VCL form's .cpp file also to the test project with (Project View) -> right click -> "Add..." -> C++Builder unit (*.cpp). My form TAdderForm that I'm using here is a simple form with two VCL TEdit fields for entering numbers and a VCL TLabel to display the sum of the two numbers. The sum is computed in a method
int TAdderForm::add(int num1, int num2)
{
return num1 + num2;
}
which I want to test here. To write the test, I add a new "Unit" to the test project as before, naming the source file "VCLTest.cpp" this time. After the IDE-generated boilerplate, I add this code to the .cpp file:
#include "adderFormx.h"
#include <gtest/gtest.h>
TEST(VCL, Addition) {
// Have to instantiate VCL form before calling its method.
Application->CreateForm(__classid(TAdderForm), &AdderForm);
EXPECT_EQ(3, AdderForm->add(1,2));
EXPECT_GT(3, AdderForm->add(2,2));
delete AdderForm; // Delete no longer used form.
AdderForm = nullptr; // clear pointer, another test may allocate new instance
}
This is basically the same test as before. The second expectation will fail again and needs to be fixed because 3>4 is a wrong expectation. The test uses the global instance pointer "AdderForm" from the form's source file for simplicity, this can be modified if required. If multiple tests want to instantiate the same form, a fixture should be used and the setup and teardown done here inside the test should be moved to the fixture's respective methods, but this is no longer C++Builder specific.
Note that Application->Run() is never called, and no GUI elements actually appear on the screen when executing the tests. I'm restricting tests to non-GUI methods of the GUI classes.

Dealing with multiple projects in visual studios

I am trying to figure out how to deal with multiple projects under the banner of a single solution and how to correctly link projects in order to make things work in conjunction.
I began by making two projects in one solution - for simplicity's sake, ProjA and ProjB. ProjB is set as the StartUp project. Furthermore, ProjA is configured to be built as a .dll file which I am to link with ProjB, which in turn is configured to be built as a .exe file. So far I've linked ProjA to ProjB by adding a dependency to ProjB via referencing (RMB>Add>Reference).
With all that out of the way, I wanted to test whether the setup worked as intended. So I did the following. In ProjA, I wrote the following Test code:
Test.h
#pragma once
namespace ProjA {
_declspec(dllexport) void Print();
}
Test.cpp
#include "Test.h"
#include <stdio.h>
namespace ProjA {
void Print()
{
printf("Testing\n");
}
}
And in ProjB:
TestEntry.cpp
#include <stdio.h>
namespace ProjA {
_declspec(dllimport) void Print();
}
void main()
{
ProjA::Print(); //breakpoint1
printf("Testing (2)\n"); //breakpoint2
}
I set two breakpoints at the commented lines for debugging, built the projects and ran the program. At breakpoint1, I expected the console to print "Testing" and proceed to the next line, followed by breakpoint2 printing "Testing (2)" and proceeding to the next line before exiting. However, the console was blank at breakpoint1. It only printed the line from the main function at breakpoint2.
So what am I doing wrong here? Is there something wrong with the way I included the projects? Was there a linking procedure I skipped? Is there a specific way I need to set up Visual Studios 2017 in order for it to work? Are there other plugins/APIs I should be installing?
To test it out further, I commented out everything in ProjA. This time I expected a linking error when building the projects, but everything ran in the exact same manner. This confused me even more. It's as if I didn't even link the projects and the main function is not identifying the Test codes via the include. That's the only thing I could deduce so far.
As suggested by SoronelHaetir, I redid the whole thing using #defines and namespaces. It's working as intended now. In conclusion, the crude method was a bad idea from the getgo.

"Failed to set up execution context" when running VC++ unit test with external dependencies

I have a solution (available on Git at this link) including one project (producing a DLL library) and a native unit test.
Visual Studio Enterprise 2015 with VC++
On Windows 10
The structure of my solution is the following:
./src
+--DelaunayTriangulator.UnitTest
| |--DelaunayTriangulatorTest.cpp
| |--DelaunayTriangulator.UnitTest.vcxproj
+--DelaunayTriangulator
| |--DelaunayTriangulator.cpp
| |--DelaunayTriangulator.h
| |--DelaunayTriangulator.vcxproj
|--Triangulator.sln
The project
My source project works and builds fine. It links some libs (AFAIK, they are basically static libraries) which are just some CGAL stuff I need as dependencies. It also runs fine.
If you have a look at the project, you will find that I link those .lib files as part of Linker options:
<Link>
<AdditionalDependencies>$(CGALDirPath)\build\lib\Debug\CGAL-vc140-mt-gd-4.12.lib;$(CGALDirPath)\auxiliary\gmp\lib\libgmp-10.lib;$(CGALDirPath)\auxiliary\gmp\lib\libmpfr-4.lib;..</AdditionalDependencies>
...
</Link>
The test project
The unit test project has been created by using the native test project walkthrough and template in Visual Studio. The test project is also linking the same .lib files that the source project does. Following is the single test I have:
#include "stdafx.h"
#include "CppUnitTest.h"
#include "../DelaunayTriangulator/DelaunayTriangulator.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace CodeAlive::Triangulation;
namespace TriangulatorUnitTest {
TEST_CLASS(DelaunayTriangulatorTest) {
public:
TEST_METHOD(PerformTriangulation) {
DelaunayTriangulator* triangulator = new DelaunayTriangulator();
int result = triangulator->Perform();
Assert::AreEqual<int>(0, result, L"Wrong result", LINE_INFO());
delete triangulator;
}
}; // class
} // ns
Before I linked those .lib files from CGAL, the project did build but did NOT run at all, showing this error message:
Message: Failed to set up the execution context to run the test
The error
As soon as I added the .lib files, the project did build and the single unit test did run only if I left the Assert line uncommented (I had to comment all the code referencing my source project):
TEST_CLASS(DelaunayTriangulatorTest) {
public:
TEST_METHOD(PerformTriangulation) {
Assert::AreEqual<int>(0, 0, L"Wrong result", LINE_INFO());
}
};
When I uncomment the code referencing my project (using the classes I define in my source project), then the same error message shows up when I try running the test:
TEST_CLASS(DelaunayTriangulatorTest) {
public:
TEST_METHOD(PerformTriangulation) {
DelaunayTriangulator* triangulator = new DelaunayTriangulator();
int result = triangulator->Perform();
Assert::AreEqual<int>(0, result, L"Wrong result", LINE_INFO());
delete triangulator;
}
};
I understand that this is due to some kind of issue with external references. What is wrong here?
So the issue here was kinda peculiar to my configuration but also generic enough to deserve an answer for other devs who might incur in this situation.
The problem was that the .dlls of my source project were not deployed to the test output folder. So you need to set OutDir in your test project properties:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
This will make the test actually copy the dlls not in the solution folder, but in the test project folder, and then the referenced source project dlls will be correctly copied. The test project file did not have an entry for OutDir, it seems that made MSBuild not copy the source artifacts.

Link: fatal error LNK1561: entry point must be defined VS2015 developer cmd window

I have read a ton of this same question, but I appear to be doing everything correctly as all suggestions advise, but am still getting this error.
I have simple .cpp and .h files in C++ using Visual Studio 2015. My program runs perfect from the gui. I need to run it in the visual studio developer command window to get the results there, this is a verified console application. I have copied the files to their own directory using:
C:\RunDirectory>copy C:\SaveDirectory\
The system verifies that it copies all 15 files.
When I run this command:
C:\RunDirectory>cl Aprogram.cpp
Then I get the error.
I have a main that is returning an int, and this is a console application with the correct linker settings: Console (/SUBSYSTEM:CONSOLE)
Any ideas? I'm pretty stumped.
This is my driver file:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include "JollyBanker.h"
using namespace std;
int main()
{
JollyBanker theBanker;
theBanker.BuildQueue("BankTransIn.txt");
theBanker.ProcessQueue();
theBanker.DisplayResults();
return 0;
}
File Aprogram.cpp is a source code file, which is compiled and linked
into an executable by Visual Studio IDE. Assuming that default project
settings are used, this executable is located in "Debug" or "Release"
subdirectory of the directory that contains your solution and it is named
ProjectName.exe (where "ProjectName" is the name of the project
within the solution that contains Aprogram.cpp)
Also, you mentioned that you want to make sure it works outside VS. Note
that if you have used the default settings, you will have problems when you
run this executable on another machine. To solve this, I suggest that you
change the runtime library that you are linking to. To do this, right click on
the project in Solution Explorer and select "Properties". Go to "C/C++" -> "Code Generation"
and change the value of "Runtime Library" to "Multi-threaded Debug (/MTd)" for "Debug" configuration, or to "Multi-threaded (/MT)" for "Release" configuration.

C++ - Using HunSpell 1.3.2 with Visual Studio 2010

My goal is to create a simple Win32 Console application that uses HunSpell to spell-check a word the user has entered.
I tried to follow this codeproject tutorial which is for Visual Studio 2008 and HunSpell 1.2.1.
I don’t want to use the provided code, since I intend to write my own.
Furthermore I want to add HunSpell as a dll, not as a static library.
Following are the steps I took:
Created a Win32 console (empty) project with the name myproject.
Downloaded HunSpell 1.3.2 from SourceForge.org.
Copied hunspell-1.3.2\src\hunspell and win_api to myproject\myproject\HunSpell-Src
Added and converted project libhunspell myproject\myproject\HunSpell-Src\win-api\libhunspell.vcproj
to the solution.
Made my debug build use debug_dll and my release build release_dll of libhunspell in the Configuration Manager.
Rebuilt the libhunspell project, libhunspell.dll is generated in debug_dll and release_dll folders respectively.
Made my console project depend on libhunspell. (Added reference to libhunspell)
Copied dictionary files en_US.aff & en_US.dic to myproject\myproject\HunSpell-Dic after downloading them from SourceForge.org.
I can’t figure out how/where to add the processor define HSPELLEDIT_DLL that is mentioned in the codeproject tutorial.
Following the steps listed under “To use the functionality from the class library in the console application” on MSDN didn’t changed the result.
I want to test it with a program like this:
#include <iostream>
#include "HunSpell-Src/win_api/hunspelldll.h"
using namespace std;
void main()
{
void *spellObj = hunspell_initialize("HunSpell-Dic\\en_us.aff", "HunSpell-Dic\\en_us.dic");
char str[60];
cin >> str;
int result = hunspell_spell(spellObj, str);
if(result == 0)
cout << "Spelling error!";
else
cout << "Correct Spelling!";
hunspell_uninitialize(spellObject);
}
VS produces the following error message if I try to compile it:
myproject\myproject\hunspell-src\win_api\hunspelldll.h(34): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
Hunspell.hxx is present in myproject\myproject\HunSpell-Src\hunspell. IntelliSense marks the #include "hunspell.hxx" as an error while the tab hasn’t focus with the message “Error: cannot open source file hunspell.hxx”, but after giving focus to it the error disappears.
Thank you for your help.
The preprocessor definition, HSPELLEDIT_DLL, is not needed unless you are going to actually use the codeproject author's custom control. In the case you want to define it (or other preprocessor definitions) refer to /D (Preprocessor Definitions).
Your path strings need to be double \\ instead of single \ escaped and you have some compile issues:
#include <iostream>
#include "HunSpell-Src/win_api/hunspelldll.h"
using namespace std;
void main()
{
Hunspell *spellObj = (Hunspell *)hunspell_initialize("HunSpell-Dic\\en_us.aff", "HunSpell-Dic\\en_us.dic");
// ^change * type ^cast returned void* to type that will be used later
char str[60];
cin >> str;
int result = hunspell_spell(spellObj, str);
if(result == 0)
cout << "Spelling error!";
else
cout << "Correct Spelling!";
hunspell_uninitialize(spellObj /*SpellObject is undefined*/);
// ^use correct variable
}
For Hunspell.hxx, you need to tell your project how to find it. To do this, open your project settings and and the path to Hunspell.hxx to 'Additional Include Directories' under Configuration Properties > C++ > General. Refer to /I (Additional Include Directories).
Based on your directory structure:
Your Project > Properties > Configuration Properties > C++ > General > 'Additional Include Directories' should look like: .\HunSpell-Src\hunspell;%(AdditionalIncludeDirectories)
Your Project > Properties > Configuration Properties > Linker > General > 'Additional Library Directories' should look like: .\Debug_dll\libhunspell;%(AdditionalLibraryDirectories)
You will also need to copy myproject\myproject\Debug_dll\libhunspell\libhunspell.dll to your projects output directory (.\Debug) or your exe will not be able to find it.