My previous questions concerning the same project: one and two. It's not necessary to read them; just know that I am trying to use a native C++ SDK in a Visual C++ project. This is much trickier than I had initially thought, but this website about Extending a native C++ project with managed code has helped me a lot further already.
As per that last link's instructions, I have added a Form to my native C++ project, which has automatically converted the project to a CLR one. Only MainForm.cpp
and Interface.cpp
(the file that allows native C++ code to create and show a MainForm) are compiled with the /clr
flag though; the other files remain native.
The problem I have now, is that Visual Studio doesn't seem to recognise any of the CLR stuff that's being used in MainForm.h
. As such, in the following lines:
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
the word System
is always underlined in red, with according errors:
error C2653: 'System' is not a class or a namespace name
for each of those lines.
It also does not recognise the word gcnew
and other things that should work effortlessly inside CLR.
Can anybody tell me what I might be doing wrong? My guess is that it's something very small; some flag I have forgotten to change, a missing reference or something similar, but I just can't figure out what it is.