No Console Window in GUI Project

General questions regarding the usage of CodeLite
evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

No Console Window in GUI Project

Post by evstevemd »

I need to see Outputs like I see in xterm in Linux. In Windows it shows only Window with GDB.exe as current command and printing a cout statement yield nothing. Is this a bug?
I saw this in CL 8.1 and it here in 8.2

Also where did the old option to see output in CL itself go?

CodeLite 15.x
CodeLite is awesome, I just Love it!

User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by eranif »

On Windows, a "Window" application does not have a terminal attached to it.
You can remove the flag "-mwindows" from the linker and it will open a console, but I am not sure that "printf" will go to it
evstevemd wrote:Also where did the old option to see output in CL itself go?
I am not familiar with this

Eran
Make sure you have read the HOW TO POST thread
evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by evstevemd »

eranif wrote:On Windows, a "Window" application does not have a terminal attached to it.
You can remove the flag "-mwindows" from the linker and it will open a console, but I am not sure that "printf" will go to it
I can see that but it cannot send printf/cout/wxPuts.

So where does Output go?
eranif wrote:
evstevemd wrote:Also where did the old option to see output in CL itself go?
I am not familiar with this
Eran
In Old CL we could see standard output (like cout/wxPuts) in some Window in Debugging mode. I don't remember which CL had it before it disappeared.

CodeLite 15.x
CodeLite is awesome, I just Love it!

User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by eranif »

evstevemd wrote:I can see that but it cannot send printf/cout/wxPuts.
This is Windows specific, you will need to read about OutputDebugString or something like that, I am not sure
evstevemd wrote:In Old CL we could see standard output (like cout/wxPuts) in some Window in Debugging mode. I don't remember which CL had it before it disappeared.
Recent CodeLItes (several versions now) are only using the native OS terminal, there is no more embedded terminal-alike in CodeLite

Eran
Make sure you have read the HOW TO POST thread
evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by evstevemd »

thank you!

CodeLite 15.x
CodeLite is awesome, I just Love it!

Syke
CodeLite Curious
Posts: 3
Joined: Sat Jan 18, 2014 7:04 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by Syke »

eranif wrote:Recent CodeLItes (several versions now) are only using the native OS terminal, there is no more embedded terminal-alike in CodeLite
Eran
The old console (in CodeLite window) was nice in that the runtime output stayed around after debugging exited. Is there any way to have the OS terminal stick around after exiting debugging so that the text can be read/copied?
Modem Man
CodeLite Enthusiast
Posts: 28
Joined: Tue Sep 11, 2012 11:50 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by Modem Man »

Is there any way to have the OS terminal stick around after exiting debugging so that the text can be read/copied?
not very very smart, but actually works for me:

Code: Select all

#include <iostream>
using namespace std;

int main(int argc, char **argv)
{
  int res = 0;
  cout << "Hello staying text console" << endl;
  cin.ignore(); // wait for input, but not read it
  return res;
}
of with non-stream functions:

Code: Select all

#include <stdio.h>
#include <stdlib.h>

int _tmain(int argc, char **argv)
{
  int res = 0;
  _tprintf("Hello staying text console\n");
  _gettchar(); // wait for input, but not read it
  return res;
}
Does it help?
MM
Syke
CodeLite Curious
Posts: 3
Joined: Sat Jan 18, 2014 7:04 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: No Console Window in GUI Project

Post by Syke »

That helps a little, but it only works if you can run to end-of-program. When debugging, if any sort of crash condition is reached, that hack won't help.
Post Reply