problem With classes, String^ and managed code in visual Studio 2008

Hi Guys,

I am trying to creat a class in visual studio 2008 (vc++). This is the code I have in badges.h file

public ref class badge
{
public:
int num;
String^ firstName;
String^ lastNamel;

badge();
~badge(){};
};

badge newBadge;
//End of *.h

when I compile this I get these errors
C2143: missing ';' before '^'
c4430: missing type specifier - int assumed
c3145: 'newBadge': global or static variable may not have manage type 'badge'
c2039: '(dtor)': is not a member of System::IDisposable

now if i take 'public ref' away then the error c2039 and c3145 goes away but I get error
c3265: cannot declare managed 'firstName' in an unmanaged 'badge'
c3265: cannot declare managed 'lastName' in an unmanaged 'badge'

I am completely new to programming and pretty sure doing a very simple mistake. I though I had the class setup right but guess not. I have done some diggin on the net and the solution did not work. This file file is part of larger project that is GUI based.

Any help in this matter will be really appreciated.
Thanks
It appears that you can't make global variables of managed types. Put that test variable somewhere else.
Topic archived. No new replies allowed.