Author Topic: Console Window Blank?  (Read 13499 times)

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Console Window Blank?
« on: January 21, 2011, 09:01:44 am »
Hey all,

I recently upgraded my nightly to 6921 and now when I debug my console window remains blank. Even when doing a simple cout output nothing shows, no execution time message nothing.

I went through and made sure my debugger was properly set, which it is, so I'm not too sure what's going on.
C::B Version = 10.5
OS = Microsquish XP

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Console Window Blank?
« Reply #1 on: January 21, 2011, 10:00:23 am »
no execution time message
This is normal when debugging, because the cb_console_runner is not used.

Do you really print to the stdout? Do you see the output without running the debugger (f9)?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Console Window Blank?
« Reply #2 on: January 21, 2011, 10:06:19 am »
High OB and thanks for the reply, (sorry, I misread what you had asked so I edited this reply to reflect answering your questions properly)

Not sure if this a bug in the latest release as well as the nightly version but it happens in both.

Just to make sure everything was up-to-date, I installed 10.5 and the blank console window is present there as well. After double and triple checking my compiler locations as well as installing a fresh Ming package, and after closing CB and rebooting the program and creating new projects a few times I was finally able to see output to the screen (and yes, I was stopping the window from auto-closing).

The console still goes blank from time to time but not as much so I'm not sure what's causing it. Also, why is there a new warning about an auto-importer? Is that a new feature just added or something?

Never saw that one before though I was able to kill it by doing the -WI, -blah blah blah in the linker box though that wasn't my greatest concern. My concern is the console window remaining completely blank especially if I'm working on extremely large and complex projects.

Also to answer your questions, yes I'm actually printing out in fact here's a tidbit I was using when testing the console window:

Code
#include <iostream>

using namespace std;

int main()
{
int A = 7;
int B = 7;

if(A > B){


cout <<"A IS greater than B!" << endl;

  }else if(A < B){

     cout <<"A is NOT greater than B!" << endl;

       }else if(A == B){

         cout <<"A is EQUAL B!" << endl;

           }else{

                cout <<"A can't be compared to that lousy letter B!" << endl;

}


cout << "Press RETURN to continue...";
cin.get();
return 0;
}

and no, I don't see anything even when not in debugging mode. However, as mentioned above, I now am seeing output but the console does go blank from time to time, especially during debugging I found.

Any ideas?

Thanks!
PS: I forgot to add this, but I don't see any errors when this happens. Everything compiles normally just with no output.
« Last Edit: January 21, 2011, 10:22:45 am by wolfcry »
C::B Version = 10.5
OS = Microsquish XP

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Console Window Blank?
« Reply #3 on: January 21, 2011, 11:33:13 am »
Do you have the problem if you use std::endl?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Console Window Blank?
« Reply #4 on: January 22, 2011, 12:17:29 am »
Not sure.

I"ll experiment with it and see if I can cause the issue.

You think it could be an issue with the std library?
C::B Version = 10.5
OS = Microsquish XP

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Console Window Blank?
« Reply #5 on: January 22, 2011, 01:41:46 am »
No, the STL is fine, your usage is wrong :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Console Window Blank?
« Reply #6 on: January 22, 2011, 03:29:58 am »
In all the years I've been programming, you're the only person I've ever known say my usage of endl is wrong since it's never been an issue before.

Using endl without the local std:: would only be wrong if I wasn't calling it globally in namespace which I am, so I'm curious to know how my usage is wrong and how this would cause the console window to go blank.

« Last Edit: January 22, 2011, 09:06:58 am by wolfcry »
C::B Version = 10.5
OS = Microsquish XP

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Console Window Blank?
« Reply #7 on: January 22, 2011, 09:16:04 am »
Quote
using namespace std;

--> then you can just type cout and endl
So the usage is correct I would say.

If you don't do the using directive, then you have to: std::cout, std::endl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Console Window Blank?
« Reply #8 on: January 22, 2011, 04:23:03 pm »
I said your usage of STL is wrong, not endl...

The problem is that << is buffered and the text does not go to the output immediately,
but waits for a flush, the flush happens in endl and you're missing it in your last cout.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Console Window Blank?
« Reply #9 on: January 22, 2011, 04:37:12 pm »
that's true, but then the previous prints to cout should have occurred, and it seems those were also invisible ? no ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Console Window Blank?
« Reply #10 on: January 22, 2011, 10:14:01 pm »
Hm, the strange formatting misled me, sorry.

I've just tried your example and it works for me.

XP sp2/3, tdm gcc/g++ 4.4.0, cb latest debugging branch nightly.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Console Window Blank?
« Reply #11 on: January 22, 2011, 11:21:19 pm »
Thanks for all the help all.

No worries OB, I wasn't mad or arguing or anything was just genuinely confused lol. I appreciate you trying to help.

Because I couldn't recreate this bug normally, I decided to mess around with CB a bit. I removed the -WI linker option I mentioned in my first post in this thread and ran a few times.

The possible bug may be associated with that auto-importer because when I run that code and a very basic "Hello World!" tidbit, it hangs and I noticed one it appeared to go blank then it processed the code and that was on the Hello World one. Replacing that linker option and restarting CB just to make sure, the debugging didn't hang as it did. So I'm thinking it has something to do with this but I could be wrong.

Also to note, this only happens during debugging not during building and running normally. And to get a picture of what I mean by going blank, it resembles the console window when you're debugging with a breakpoint set at "int main". Just a blinking cursor as the program waits for you to step into it.

Just so I know I'm using the right linker option syntax, is it "-WI, -enable-auto-import"  or "-WI --enable-auto-import"?  The first one only has one '-' in front of enable, the second has two. I'm currently using the first one.

Thanks
« Last Edit: January 22, 2011, 11:32:26 pm by wolfcry »
C::B Version = 10.5
OS = Microsquish XP

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Console Window Blank?
« Reply #12 on: January 23, 2011, 11:59:44 am »
Just so I know I'm using the right linker option syntax, is it "-WI, -enable-auto-import"  or "-WI --enable-auto-import"?  The first one only has one '-' in front of enable, the second has two. I'm currently using the first one.
Its:
Code
-Wl,--enable-auto-import
Notice, that there are no spaces and take are of upper/lower case characters. Otherwise the linker won't recognise this option and throw an error. Of course, this does only apply to the GCC compiler/linker. Place it in the linker options.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Console Window Blank?
« Reply #13 on: January 23, 2011, 07:14:19 pm »
Thanks MortenMcFly.

That's weird because I was using -WI, -enable-auto-import and I wasn't receiving any errors (other than maybe the blank console window if this is indeed associated). In either case, I changed it to what you posted so hopefully this will clear up any issues I was having.
C::B Version = 10.5
OS = Microsquish XP