I have written some C++ Classes for a console application.
How do I use these classes in a VCL Forms Application. I am using C++ Builder XE2.
I have added the .h and .cpp files via the Project->Add to project. Do I need to write an include statement? If so, where do I do this?
I tried placing the include statements at the top of the .cpp file, yet I get the following error: Unable to open include file.
I have the .h and .cpp files in the same directory as the Forms project.
Thanks
This is a quick hack. It worked for me.
Move the entire class you wrote from the
.CPPfile in to the.Hfile. Move everything.In the .
CPPfile of the vcl form,form1.cpp, include the.Hfile that contains the C++ Classes.or you could just paste parts of the class methods into
form1.hso they become part of thepublic ref class form1{};class all together instead of having two different classes clash, the form1 class and your class.