I created a "CLR Empty Project (.Net Core)"
project using Visual Studio 2019.
I simply created a new class using the 'add class' menu option and it generated this class.
I added the function called Test
in the header:
using namespace System;
public ref class Class1 {
// TODO: Add your methods for this class here.
void Test();
};
Then using visual studio's generate implementation option it created this function defenition in the .cpp file:
#include "EngineEditorLayer.h"
#include "pch.h"
void Class1::Test() { throw gcnew System::NotImplementedException(); }
When compiling it gave me this error :
error C2653: 'Class1': is not a class or namespace name
I can only resolve this error by moving the implementation to the header file.
Am I missing something? Is there a setting I have to change to enable .cpp compilation? Is there a compiler bug that prevents me from doing this currently?