World's simplest MC++ question

Raven Darque

Newcomer
Joined
Sep 24, 2003
Messages
5
Location
Hampshire, UK
I should warn you that I'm failing miserably at learning MC++. :o)

This must be simple, but I'm totally stumped. All I'm trying to do is create two _gc classes and use one in the other. I put one class in the default header file created by VS.NET (it's a .NET Class Library project), then I created another cpp and associated header file and put the second class in the new header file - the way I would normally work in C# (my 'native' language). Now, when I try to create an instance of the second class in the first, I get a compiler error:

error C2061: syntax error : identifier 'MyClassName'

I tried to include the full namespace ('explicit is good' I'm told) but then I get the following compiler error:

error C2039: 'Retriever' : is not a member of 'Odyssey'

Both the tooltip and intellisense seem to concur that the class is the right one and can be found, but the compiler doesn't agree. What am I doing wrong?
 
Am I alone here?!

Come on guys! Someone must know what I'm talking about! Maybe an example will help:

Code:
//File1.h
#pragma once
using namespace System;
namespace MyNameSpace
{
	public __gc class MyCallingClass
	{

	private: void MyMethod()
		//the following line fails with a compiler error
		MyCalledClass *mcc = new MyCalledClass();
	};
}

//File2.h
#pragma once
using namespace System;
namespace MyNameSpace
{
	public __gc class MyCalledClass
	{

	public: void DoSomething()
		//do something...
	};
}

Why doesn't this work?! Surely this is the simplest thing in the world?
 
Okay, I found out from another newsgroup. I needed to #include the second file in the first.

It's like a ghost town here.

I feel like I'm talking into a void.

Alone.

In the dark.

...

.

.

.

Just kidding.
 
Back
Top