Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespace problems

Status
Not open for further replies.

mbaranski

Programmer
Nov 3, 2000
421
0
0
US
So, I've got a VC++ service.

Defined as:

Code:
namespace xy
{
   public __gc class z
   {
      // Class code.
   };
}

Now, I've got another class, in another .h/.cpp file:
Code:
namespace xy
{
    public __gc class abc
    {
        // Class code;

    };
}

The problem is, I cannot use class abc inside of cass z. It tells me that class abc cannot be found.

If I include the header file, nothing.

If I change abc's namespace and 'use namespace newns' in class z, nothing. Even if I include the abc.h, nothing.

What do I need to do to allow class z to instantiate class abc?

Everything compiles OK, just when I try to reference the class abc from the class z, I get errors.

They are undeclared identifier, and if I use the ns::class convention, I get the error that class is not a member of ns, even though it shows up properly in the "Class View" window.

Thanks.
 
That doesn't even look like valid C++ to me??
Why is the 'public' before the word 'class' instead of inside it like this:
Code:
class abc
{
public:
    // class code.
};
 
Never mind, it had to do with each class including the others .h file and this was screwing up the compiler.

Makes no sense, but it's fixed now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top