I've created a class to control a robotic arm via USB. It works perfectly in the command line but I cannot make any headway getting it to work with a MS Visual C++ 2010 express Form. I include the header file, but whenever I try and create an object in Form1.h I get a linker error. I have tons of C++ experiences regarding backend stuff, but this is my first time playing with a GUI and I am getting my butt kicked. I really have googled the hell out of this and cannot find the solution.
What is the proper way to allow a Form's button to activate a function in a separate class? That is, given, RoboticArm.h, where do I include the header file and where do I create an Object
RoboticArm TestArm ;
so that when I click the button, in the Click event I can say, TestArm.Move(); , or some similar solution.
Thanks for any help, I really appreciate your time.
// ArmGUI.cpp : main project file.
int main(array<System::String ^> ^args)
//THIS LINE HERE BREAKS THE BUILD
//THIS LINE HERE BREAKS THE BUILD
// Enabling Windows XP visual effects before any controls are created
// Create the main window and run it
I don't know why the line where I try and create an object OWI535 breaks the build, but it does, with this error:
ArmGUI.obj : error LNK2019: unresolved external symbol "public: __clrcall OWI535::OWI535(void)" (??0OWI535@@$$FQAM@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
Thanks for the help bud. miss quote: "...regarding backend stuff", as in DSP work and embedded systems. This is my first time dealing with MS VS and its GUI wizard (There's a hint in the title). Honestly, thanks for pointing out that it's not standard C++.
Seeing as you're such a kind troll, would you mind pointing out where my blatant idiocy and inexperience has led me astray? I need a form with 6 buttons and each button has to call one function - the allure of a 5 minute point-and-click solution was great. Would you say for such a simple requirement it would be better to drop the proprietary stuff and setup a Qt/wxWidgets system on windows? Coincidentally I see wxWidgets has actually released binaries for MS VS for the first time... I have to develop in MS VS because I'm inheriting a project and a colleague that only works on the Windows platform in MS VS.
Anyway, any help will greatly be appreciated to get the proprietary stuff to work if the folks on this forum don't mind it. In the mean time I'll get a wxWidget project up and running.
MS Visual Studio can use standard C++ as well, select "win32 application" from project wizard. If you use Express Edition, then there the resource editor is not included ( you could create a simple dialog-based application which uses only win33api directly and use a 3rd party resource editor for free, like resedit, which generates the neccesary files for you which must be added to VS project using a drag & drop interface) http://www.resedit.net/
Silverstar is correct. Double click the button on design view to add code to the event. Did you add your header file to the project by right clicking the project folder and selecti g add existing item ?
Thanks for all the replies. Modoran, resedit ia very useful. I've downloaded the Win7 SDK and see how that goes.
Silvestar/bobdbilder, I understand how it is supposed to work from the VB6 and Delphi 6 work I've done, but it's not. :)
I've given up trying to get this to work - I'm obviously doing something wrong but I'm running out of time on how to fix it. I've pulled in all my source code and header files that created the API, moved all the include directives to stdafx.h and now I'm just compiling and linking everything in one project to one executable. This is working and I'll leave it at that for now.
Again, thanks for the replies, and thanks for the resedit tool, I really appreciate it.
Did you add the import library for your arm dll to the linker input. The error you're getting is a linker error.
I'm guessing your robot arm control library is a native DLL?
I've linked unmanaged i.e. native DLLs to managed i.e. C++/CLR code and it just works, although I instantiated my objects on the unmanaged heap, rather than as concrete objects e.g. In your form class, add a pointer to your object, and create it with new, and destroy it with delete (rather than using gcnew as you would with ref classes). Then you shoudl be able to call methods on your object using the standard -> operator.