C++ or Python (maybe else) to create GUI for console application in C

I have a Visual C console application (created in VC++2008EE) and I need to add GUI to it.

One idea was to invoke the console app as a subprocess and communicate with it using stdin and stdout. I tried to do that with Python subprocess module - but it deadlocks (probably because my console app is running continuously). As I understood from http://www.python.org/dev/peps/pep-3145/ it is not possible now to integrate continiously running console application with python subprocess module.

The other idea (more strait-forward probably) was to add a form to this console application project. But as I try to do it VS convers the project to one with "Common Language Runtime support" whatever it means, ads the form, a cpp file for form - and it's not compiling anymore saying:

Command line error D8016 : '/MTd' and '/clr' command-line options are incompatible
error BK1506 : cannot open file '.\Debug\Form_TEST.sbr': No such file or directory

No idea what it means. I have never dealed with C++, but I have used C and Python some time.

What would you recommend?

Answers


If you own the code for the console app, don't mess around trying to talk to it using input and output streams. Extract the logic of your console app into a library, and call that library from a GUI of your choice - either Windows.Forms from C#, Python GTK, ordinary GTK.


The reason that VS turns your application to CLR type is becuase it accidently thinks that you want to use winforms which are part of the .NET framework and the only way to use them is if your project is .NET as well.

You do have other options: 1. Add MFC GUI - native C++ GUI 2. better yet create a new .NET project (C#/VB.NET) with the desirect GUI and call your C/C++ dll using P-Invoke or COM interop


Need Your Help

How to get the information of the last packet recieved using Scapy

python packet scapy packets

I am using srp1() of Scapy to replay pcap file to a device as follows:

How to return 3 closest locations from to users location using jQuery or JavaScript

javascript jquery sqlite jquery-mobile

In my mobile app, I've got users geolocation using the following code. I also have a geolocaion (latitude, longitude) of nearby cities. I can put the geolocation data of cities in array or SQLite