Header files / CPP files ?



This has got to be something really simple, but I'm pretty baffled...[VC++
..NET 2003]

In the header file I define the class interfaces, in the CPP file the class
functions, and the
CPP file #includes the header file. Looks like Stroustrup style code.

The only way I can get it to complile is to declare (again) the class within
the cpp file.

If I don't redeclare it but instead just put all the
Classname::Method(parameters){ code };
in the CPP file, I get thousands of compile errors. They seem to object
whenever I use any of
the managed types. The functions that don't use anything but ints, etc. seem
to compile OK.

What is simple that I'm missing?

-- Tom



Shutdown and rebooted, then fired up VC.NET and most of the errors
The ones that were left had to do with __property keyword. Apparently
it's a declaration
type of keyword, so just had to remove it from the .CPP file were the
properties are coded.

..H file:

_gc public class MyClass
int MemberVal;
__property int get_MemberVal();

..CPP file:

// bad __property int MyClass::get_MemberVal() { return MemberVal };

// good
int MyClass::get_MemberVal() {return MemberVal };

Sure am puzzled whey shutting down and rebooting cleared so many compile
(even after forced rebuild_all).

-- Tom

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