MC++ DLL (VS.2003) compiler errors...(sigh!)

A

A. Nonymous

First off, I would like to state that I'm using VS.2003 / .NET Framework 1.1
and the MC++ that comes with it. I am stuck with this IDE for the time
being as I am supporting some older platforms. So, I'm not going to be
migrating to VS.2005 just yet!

I have been working on trying to create a DLL written in MC++. It has
been a while since I've touched C++ and this is my using MC++. However, I
thkink I've been making reasonable progress with this DLL but there just
seems to be the ever mounting pile of compilation errors.

The latest batch are a bunch of C2011: 'class' type redefinition
errors. I think this is simply due to my ignorance of MC++ and what to
include in the header and cpp files. I've managed to figure out that
Interfaces go into header file but that's all I think I have right. Without
going into too much detail my basic layout looks something like:

====Header====
// MyFile.h
using namespace System;
using namespace System::IO;
....

namespace MyNameSpace
{
public __gc class A
{
// Methods
public:
A(); //default constructor
void __gc* One();
...

// Fields
protected:
String __gc* file;
String __gc* text;
Int32 line;
...
}



====MyFile.cpp====
// This is the main DLL file.
#using <mscorlib.dll>

#include "stdafx.h"
#include "MyFile.h"

namespace MyNameSpace
{
public __gc class A
{
// Methods
public:
A() //default constructor
{
}

void __gc* One()
{
//define method here
}
...

// Fields
protected:
String __gc* file;
String __gc* text;
Int32 line;
...
}

Obviously, those aren't the real namespace, class and method names but
it should be enough to give you an idea. If someone could point out what
I'm doing wrong or, at the very least, point me towards a good MC++ tutorial
site it would be much appreciated.

TIA...
 
S

Sheng Jiang[MVP]

use #pragma once to prevent duplicate declarations when your header file is
included multiple times in a source file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top