I created a basic C++/CLI library, it has two classes. One is supposed to be the unmanaged wrapper that will be called through by regular C++ implementation. The CLI project builds correctly but when I try to call it I get the error: "C1190: managed targeted code requires a '/clr' option". I don't want to use the clr option on the C++ implementation. Am I doing something wrong?
C++/CLI code:
ProcessorNative.cpp
#include "StdAfx.h"
#include <vcclr.h>
#using <mscorlib.dll>
#include "PreProcessorNative.h"
#include "PreprocessorWrapper.h"
namespace PreprocessorWrapper{
PreProcessorNative::PreProcessorNative(){}
PreProcessorNative::~PreProcessorNative(){}
double PreProcessorNative::Test(double d){
gcroot<PreprocessorWrapper^> _preProcessor = gcnew PreprocessorWrapper();
return _preProcessor->Test(d);
}
}
ProcessorNative.h
namespace PreprocessorWrapper {
public class __declspec(dllexport) PreProcessorNative
{
public:
PreProcessorNative();
~PreProcessorNative();
double Test(double p);
};
}
PreprocessorWrapper.h
namespace PreprocessorWrapper {
public ref class PreprocessorWrapper
{
private:
public:
PreprocessorWrapper();
double Test(double p);
};
};
PreprocessorWrapper.cpp
#include "stdafx.h"
#include "PreprocessorWrapper.h"
namespace PreprocessorWrapper{
PreprocessorWrapper::PreprocessorWrapper(){
}
double PreprocessorWrapper::Test(double p){
return p*p;
}
}
Regular C++ code:
#include "..\Preprocessor_Wrapper\PreprocessorNative.h"
/*Just with the include I get the error, even before I try to use the class*/
P.S. I already added the .obj file path to the linker on the C++ project.