I'm trying to do something very simple in C++/CLI, however I'm running into issues with Visual Studio and I can't figure out why.
I have two projects, one which contains a header file named JNIUtils.h. Its content is very barebones -
#pragma once
class JNIUtils
{
public:
JNIUtils( void );
~JNIUtils( void );
};
and its implementation is very simple as well -
#include "stdafx.h"
#include "JNIUtils.h"
JNIUtils::JNIUtils( void )
{
}
JNIUtils::~JNIUtils( void )
{
}
All I'm trying to do is to create an object of this newly defined type in another project. In the project where I'm including this header file, I've gone to
Project Properties > Configuration Properties > VC++ Directories > Include Directories
I added an entry with the path to where the header file I'm including resides (JNIUtils.h)
The CPP file I'm trying to create an instance of this object in looks as follows:
#include "stdafx.h"
#include "JNIUtils.h"
using namespace System;
int main(array<System::String ^> ^args)
{
JNIUtils *util = new JNIUtils();
Console::WriteLine(L"Hello World");
return 0;
}
When I try to compile I get the following errors:
Error 3 error LNK1120: 2 unresolved externals C:\zcarter\UDK\WebSvcClients\Debug\JNITester.exe JNITester
Error 2 error LNK2019: unresolved external symbol "public: __thiscall JNIUtils::JNIUtils(void)" (??0JNIUtils@@$$FQAE@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\zcarter\UDK\WebSvcClients\JNITester\JNITester.obj JNITester
Error 1 error LNK2028: unresolved token (0A000009) "public: __thiscall JNIUtils::JNIUtils(void)" (??0JNIUtils@@$$FQAE@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\zcarter\UDK\WebSvcClients\JNITester\JNITester.obj JNITester
Can anyone tell me what I'm doing wrong here?