Sign in to follow this  
Cydriic

How to add a Console and Output to an existing New Empty Project

Recommended Posts

Hi Everyone,

 

 

I started a new Empty Project a couple of months ago and now I'm realizing that I could really use a console and output to it for debugging purposes.

 

How do I add that feature to my existing program?

 

Could anyone help me with that?

 

 

 

 

Thanks a lot.

 

 

 

Cydriic

Edited by Cydriic

Share this post


Link to post
Share on other sites

Simple console approach for Windows:

 

using Visual Studio, create a console app project - the entry point with be _tmain(...). The app will open in a console window. "#include <iostream>" will provide std::cout and std::cin. You can use std::cout << "Some debug info: " << some_debug_value << "\n"; as desired.

 

From _tmain, call your app starting point.

Edited by Buckeye

Share this post


Link to post
Share on other sites

Hi BuckEye and Thank you for your Reply...

 

I'm trying to add a Console to an existing project, not start a new Console Window Project.

 

How do I add the Console to a Project that was started as an Empty Project at the Origin?

Share this post


Link to post
Share on other sites

assuming visual studio, open the project property pages. linker-->system-->subsystem. Choose console and add a main() entry point for the program.

 

int main( void ){

//good enough

}

 

how did you create the empty project though? Looks like you have to pick windows,console, dll, or static lib when you create a new project.

Edited by jms bc

Share this post


Link to post
Share on other sites


I'm trying to add a Console to an existing project, not start a new Console Window Project.

 

You're providing no information on what IDE you're using, what operating system, etc. Both jms bc and I are just making guesses. It sounds like you might be using Visual Studio and Win32. If you want more specific answers, provide some specific information - what IDE? what version? what API?

Share this post


Link to post
Share on other sites

I Everyone and Thank you for your answers.

 

I am using Microsoft Visual C++ 2010 Express on Windows 7 and Programming on OpenGL API.

 

I'm trying to get a Console to Open in the BackGround of my application so that I can Output Values to debug my 3D Game when I'm encountering issues and I need where some values are at and how they are behaving.

 

 

Thanks a lot guys.

 

 

Cydriic

Edited by Cydriic

Share this post


Link to post
Share on other sites
If all you want is to spit out text so you can see what's going on in your program then you don't need a whole console for that, just use OutputDebugString and whatever you give it will go to MSVC's output window in the IDE.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this