#include <vcclr.h>

  • Thread starter Thread starter Tommy Vercetti
  • Start date Start date
T

Tommy Vercetti

I'm new to Managed C++ development, and I can't seem to get started.
Every time I try to include vcclr.h I get bizarre compilation errors.
I've isolated this to a really simple case:

In Visual Studio .NET 2003, I do the following
1) File->New->Project
2) Visual C++ Projects->.NET->Windows Forms Application
3) Project->Add New Item->C++ File
4) Replace the contents of the new C++ file with the simple lines:
#include "stdafx.h"
#include <vcclr.h>
5) Build->Build Solution

I get the following compilation errors:
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\stddef.h(28) : error C2144: syntax error : 'int' should
be preceded by ';'
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\stddef.h(28) : error C2501: 'p' : missing storage-class
or type specifiers


Any help is greatly appreciated.

(Sorry for the repost; but I didn't get a response to my earlier post so
I'm trying to reword and clarify)
 
I think you need to include mscorlib.dll before you can include vcclr.h. mscorlib.dll is the main include file for MC++. I think vcclr.h is just some useful utilities. Try the following

#using <mscorlib.dll
#include <vcclr.h>
 
Hi,

Follows is the response to your earlier message that I posted :-)

I'm using vcclr.h without any probs. I'm also compiling Boost under a mixed
compilation without any problems.

The following should be OK, for example:

#pragma once
#include <vcclr.h>
#include <boost/shared_ptr.hpp>

namespace SomeNamespace
{
__gc class ManagedClass;
}

class UnmanagedClass
{
public:
gcroot<SomeNamespace::ManagedClass *> myManagedClassP;
boost::shared_ptr< int > myBoostP;
}

As for obscure compiling and linking errors, I've had a few but they've
generally been solvable. Hope this helps a bit, if it doesn't, try posting a
bit of example code that doesn't work.

Steve
 
Back
Top