I'm using VS Studio C++.NET PRO 2002 and created the default "Hello World"
Managed C++ Application. For some reason the following namespace declaration
results in a 'can't find this namespace" error when I add it:
using namespace System::Windows::Forms;
while :
using namespace System;
is just fine. I want to create a managed application using C++ using the
Form class (and other controls).
What's wrong?
Alex Thaman - 04 Oct 2005 06:56 GMT
By default, the compiler imports .NET classes from mscorlib.dll (actually this might be done explicitly in code in 2002 - can't remember off the top of my head). mscorlib.dll contains most of the commonly used .NET classes.
System::Windows::Forms classes are located in System.Windows.Forms.dll, so you need to first explicitly import this DLL with
#import <System.Windows.Forms.dll>
because only winforms apps use these classes.
Hope that helps!
-Alex
-----Original Message-----
From: Alex Thaman
Posted At: Monday, October 03, 2005 5:39 PM
Posted To: microsoft.public.dotnet.languages.vc
Conversation: Namespace not being recognized
Subject: Namespace not being recognized
I'm using VS Studio C++.NET PRO 2002 and created the default "Hello World"
Managed C++ Application. For some reason the following namespace declaration
results in a 'can't find this namespace" error when I add it:
using namespace System::Windows::Forms;
while :
using namespace System;
is just fine. I want to create a managed application using C++ using the
Form class (and other controls).
What's wrong?