I have a C++/CLI form, and a native class in separate files.

I include the header file of the native class at the top of the Form.h

This causes the compiler to try to compile the constructor of the Form as a native function and spits out 100+ errors and causes the compilation to halt.

Any ideas why?

What /clr setting do you have set for the compilation? If you don't have any on there, it will try to compile your code as native.

I added a #pragma managed before the form's definition and it works fine now. <shrug> the clr settings are correct.

Good to know. I'll have to keep my eyes out for some guidelines about this kind of thing. I'm starting to figure out a bit more about the optimizations of the managed code and the juggling act that goes on with the unmanaged pieces, but in terms of the settings it's confusing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.