Menu

Where's the output window?

2007-06-30
2012-09-26
  • Nobody/Anonymous

    For some reason the output window in my dev c++ doesn't show up at all

    include <iostream>

    using namespace std;
    //Screen attributes

    int main( int argc, char* args[] )
    {
    cout<<"abc";

    return 0;
    

    }
    When I run it, there is no error, but absolutely nothing shows

    That command prompt like output doesn't show :(
    printf doesn't work either.

    How do I get it bacK?

     
    • Nobody/Anonymous

      Say "Wee Willie Winkle" five times as fast as you can.

       
    • Nobody/Anonymous

      Have you read the first few pages of the book/tutorial or just skiped to the code examples?

      Have you read the post called "PLEASE READ BEFORE ASKING A QUESTION"?

      If you have or do and your still stuck I'll flippin tell u.

       
    • Ultim

      Ultim - 2007-07-01

      Y'know, no matter how much you want them to, nobody's going to read the disclaimer. It's good to have it there for the few that will, but as for the others just be kind, be patient, and tell them what they need. We all do stupid things.

      With that, the problem is C++ doesn't hold the screen for you. You have to tell it to. You can do this two ways: putting "system("pause");" at the end, or putting "getch();" at the end (if you do getch, you have to #include the conio.h library), after your cout or printf (cout's better... 'cause it's C++... and C++'s better.)

       
      • Nobody/Anonymous

        No one is going to read "Please Read Before Asking a Question" because there is always some idiot like you giving the solution to the lazy bums.

         
    • Nobody/Anonymous

      I know that, I have added those things there, I just made a simple example to show the problem. Can't believe that caused me more problem

      It's not that the window disappears

      It simply does not show at all

      That's the problem

       
    • Nobody/Anonymous

      Copy-paste your's full code
      idem the full compile-log

      Post it here

      Old Newbie

       
    • Ultim

      Ultim - 2007-07-02

      Yeah the whole SDL part was pretty important. I don't necessarily think that the "basic 3" are always necessary, but at least include factors that you know quite well could be part of, or the full reason for the problem. In any case, i'm 95% sure Wayne's right. Most of the SDL stuff has you shut off your console window. If i'm reading your mind, you're trying to do error messaging for your SDL code. Write it to a file instead. Here's how i did it for my SDL programming:
      void sdlbase::log (string message) {
      / Precondition: Error's write-to file opened /
      error << message; //Tells the buffer to write the parameter to the file as soon as it can
      error.flush(); //Commands the buffer to write it immediately... or else. Or else what? Exactly.
      / Postcondition: Error message safely written to file. /
      }
      I'm currently trying to work out a pop-up window error notification system in SDL that i can use in parallel with these file-writing error methods, but i've run into trouble linking files and haven't gotten past that to do it. If you happen to accomplish this, please post your code. If not, i'll work on that next and try to remember to post my code here when i do.

       
    • Nobody/Anonymous

      I know the problem

      try adding system("pause"); just before your return 0;

       
      • Nobody/Anonymous

        Read the thread before posting a wrong answer.

         
    • Nobody/Anonymous

      On lazy hours I like to visit "another great place to ask questions" to look at plonkers putting their heart and soul in crunching people asking "where's my output?". You should take money for that.

       
    • Nobody/Anonymous

      and btw, I'm not new to c++

      I'm just using this code to test something

      I was playing around with SDL, for some reason the text doesn't appear on the screen and I remembered this problem, so I somehow lost the text support

      It came back after I reinstalled dev c++

      so problem solved, but mystery remains: why

      any ideas, geniuses?

       
      • Wayne Keen

        Wayne Keen - 2007-07-02

        This is a good example of why it is important to post your full Basic 3, even when what you are dealing with is a run time error.

        The odds here are better than average that you are compiling a console program as a Windows program - when you do that, you output will not show up.

        This could have been determined if you had posted your Basic 3, as somewhere in there one would see:

        -mwindows

        if what I suspect is true. (It also might not be, but with the log, we can tell for sure)

        Please get in the habit - always post your Basic 3 - even when you think you don't need it, you very well might, and posting it avoids posts like this one.

        ;-)

        Wayne

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.