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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Managed Problem

Status
Not open for further replies.

Dannybe2

Programmer
Jan 31, 2001
136
GB
I have a problem using managed code, I don't know a lot about it and any tutorials I have found just confuse me more.

Here is some code with the errors its producing:
Code:
//main.cpp
Manage* manage;

int WINAPI WinMain(..,..,..,..)
{
    manage = new Manage();
    manage->Method();

    return 0;
}

Code:
//manage.h
__gc class Manage
{
public:
    static Process* m;

    Manage();
    Method();
}

Code:
//manage.cpp
Manage::Manage();

void Manage::Method()
{
    m = Process::Start(NULL);
}

error C3145: 'manage' : cannot declare a global or static managed type object or a __gc pointer

error C2653: 'Manage' : is not a class or namespace name

I suspect it might be my use of a constructor but I'm not sure. Can anyone help me out with this?

Dan
 
I believe it should be:
Code:
int main(){
Manage* m;
m = new Manage;

m->Method();
}

I'm not entirely sure about that though - read more at
-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top