1

How can I convert a GUI C++ application to a console application?

1
  • 9
    your question is very vague, please explain your question better? If you have a C++ gui app with windows and toolbars, you can't convert it into console, unless of course you have a separated shell code then maybe you can re-write the shell. Commented Mar 2, 2011 at 5:38

2 Answers 2

8

A good way to start is to separate the "business logic" from the "display logic". That way you can keep the business logic the same, but rewrite the parts that display it on the screen to write to standard output instead. However, if your application already has them mixed together, it's not always easy to separate them out; ideally you want to start with the logic decoupled.

Other than that, you'll want to use std::cout to write to the console, and compile the application as a console application instead of a GUI one.

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

2 Comments

You can also use ncurses to hack together an ascii-art gui. Very rudimentary and not recommended for significant projects, but it can work for simple things.
If you use curses, don't forget the CDK which makes some curses jobs easier ;)
5

If you're asking how to convert your existing VS project from GUI to console, look at project properties under Linker/System, and set the SubSystem to Console.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.