0

I have more than 5 C++/OpenCV projects and i want to combine them in one project with one GUI.

Exemple : When i click Button1, i get the project1 started etc... First, i tried QT but i had some link problems with the openCV, then i used MFC and i found it complicated because i am having to rewrite parts of the projects. Now i am thinking of using the C#/WPF GUI with C++ .dll, but i still have some questions:

1- Is this idea really possible?

2- How to transform an existing C++ project into a .dll. Should i use the .exe or the .cpp/.h files?

3 - Is there any specific things to do because i am using OpenCV and i am not sure if it can work with C#.

4- Do you have any good tutorial that could help me?

One final thing, please tell me that it is going to be simple task because i spent a long time in coding the projects and i thought that the step of the GUI should be easy!

Thank you

5
  • Do you want everything to be contained in a single GUI or everything to be run-able from a single GUI? If you just need to run the programs you could always create a small program and use Process.Start(example.exe). Commented Aug 1, 2013 at 18:16
  • I've personally done what Zach suggests and that was good enough for my purposes. The downside is that you have to re-deploy the .exe every time a change is made(to the project that made the .exe), and with 5 .exes that might be cumbersome. I would suggest makefile magic on your 5 C++ projects that will automatically compile the projects and place the .exes where you want them. Commented Aug 1, 2013 at 18:21
  • Didn't notice your edit. One second and I'll alter my answer to fit better with the question. Commented Aug 1, 2013 at 18:29
  • What compiler/IDE are you using for C++? Commented Aug 1, 2013 at 18:34
  • @user1343762 Edited the answer to better suit your question. :) Commented Aug 1, 2013 at 18:48

1 Answer 1

1

There are a couple good methods depending on what you want to do. The easiest if you have multiple projects is to create a small program and call Process.Start(example.exe). Process.Start() just opens a file in whatever default manner is defined for that extension. Of course, that won't actually be integrated into a single GUI but there's essentially no overhead to it whatsoever.

Your other option is to compile everything into class libraries and add references in the C# application to the resulting .dll files. It's easy then to make calls to the .dll file without the overhead of further implementation.

What it will take to compile your specific projects into class libraries is rather hard to say as it varies depending upon what you can salvage and what will need to be re-implemented in the C# application. The absolute easiest approach would be to scrap the GUI and only worry about the code at this point. Past there you can re-implement the GUI itself using WPF.

Compiling to a .dll file is relatively simple and once .dll files are compiled and a reference is added to the C# application calling methods from the .dll file is as simple as calling from a class in the application itself. I will note that methods will require the public keyword if you want to access them but I'd imagine they most likely do if they're already implemented in a working application.

A great tutorial on generating class libraries in VS11 can be found here: http://msdn.microsoft.com/en-us/library/vstudio/ms235636.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.