In my visual studio solution I have a dll containing native C++ code, a C++/CLI dll where I am trying to implement a wrapper for my unmanaged types, and finally my C# application.
I am currently unable to reference my unmanaged types in my wrapper dll.
Code Snippet:
// In the unmanged file (in the unmanged dll project)
using std::vector;
namespace populationwin32
{
class PopulationWin32
{
public:
PopulationWin32();
// ...
};
}
// In the managed file. (in the manged dll project)
using namespace system;
using populationwin32::PopulationWin32;
namespace GSODFileParsing
{
public ref class PopulationWin32Wrapper
{
public:
PopulationWin32Wrapper();
private:
PopulationWin32 *_populationWin32; // unmanaged object
}; // End class
} // End namespace
When I try to compile the managed dll (containing the wrapper) I get the following errors:
Error 1 error C2653: 'populationwin32' : is not a class or namespace name
Error 2 error C2873: 'PopulationWin32' : symbol cannot be used in a using-declaration
Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Any ideas what these errors mean? I'm thinking they are from not correctly linking to the unmanged dll, but I'm not sure how to do this and everything I find online says something different. Any body know how to correctly and completely link an unmanged library (dll project) with a managed VC++/CLI wrapper library (dll project)?
Note: Both these libraries are projects in a single visual studio solution.
Edit: Thanks to Olaf Dietsche's comments I added
#include "PopulationWin32.h"
To the wrapper header file but now I get the following error:
Error 1 error C1083: Cannot open include file: 'PopulationWin32.h': No such file or directory
Is there a setting I'm missing or do I need to include the header file in both DLL projects? BTW, I added the unmanged dll output .lib file as a dependency to the managed dll via properties->configuration properties->linker->input->Additional Dependencies.
populationwin32::PopulationWin32
? – Olaf DietschePopulationWin32.h
. You must add it to the compiler's include path. – Olaf Dietsche