Compiler problem

Discussion in 'Programming General' started by dam prayer noobs, Dec 12, 2009.

Thread Status:
Not open for further replies.
Compiler problem
  1. Unread #1 - Dec 12, 2009 at 11:41 PM
  2. dam prayer noobs
    Joined:
    Nov 27, 2005
    Posts:
    1,789
    Referrals:
    0
    Sythe Gold:
    0

    dam prayer noobs Guru
    Banned

    Compiler problem

    I'm new to programming so bear with me. I dled the mingw compiler along with devcpp and whenever i try to run my program the black screen momentarily appears and disappears. I downloaded the digital mars compiler also but that doesn't seem to work. I have windows 7 if that makes a difference or not. Can anyone tell me what the problem seems to be? thank you.
     
  3. Unread #2 - Dec 13, 2009 at 12:12 AM
  4. Goomba
    Joined:
    Nov 21, 2009
    Posts:
    100
    Referrals:
    0
    Sythe Gold:
    0

    Goomba Active Member

    Compiler problem

    Yeahh, does your script have return(0) or system("pause")

    Please show me your script
     
  5. Unread #3 - Dec 13, 2009 at 1:42 AM
  6. dam prayer noobs
    Joined:
    Nov 27, 2005
    Posts:
    1,789
    Referrals:
    0
    Sythe Gold:
    0

    dam prayer noobs Guru
    Banned

    Compiler problem

    Yeah there's nothing wrong with the script. It compiles successfully but I can't run it for some reason. Whenever I press "run" the black screen pops up and I can read the stuff but the screen just disappears like instantly after it opens.
     
  7. Unread #4 - Dec 13, 2009 at 1:45 AM
  8. blindkilla
    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord

    blindkilla Guru
    $25 USD Donor New

    Compiler problem

    Yea this is because you need to throw a pause in. Nothing wrong with the compiler.

    Add the include:
    Code:
    #include <stdlib.h>
    And at the end of your code (before the return) add:
    Code:
    system("PAUSE");
     
  9. Unread #5 - Dec 13, 2009 at 1:58 AM
  10. dam prayer noobs
    Joined:
    Nov 27, 2005
    Posts:
    1,789
    Referrals:
    0
    Sythe Gold:
    0

    dam prayer noobs Guru
    Banned

    Compiler problem

    holy shit thank you. im following a book on it and it didn't saying anything about a system("PAUSE"); but thank you.
     
  11. Unread #6 - Dec 20, 2009 at 7:50 AM
  12. Sythe
    Joined:
    Apr 21, 2005
    Posts:
    8,075
    Referrals:
    468
    Sythe Gold:
    5,290
    Discord Unique ID:
    742989175824842802
    Discord Username:
    Sythe
    Dolan Duck Dolan Trump Supporting Business ???
    Poképedia
    Clefairy Jigglypuff
    Who did this to my freakin' car!
    Hell yeah boooi
    Tier 3 Prizebox Toast Wallet User
    I'm LAAAAAAAME Rust Player Mewtwo Mew Live Free or Die Poké Prizebox (42) Dat Boi

    Sythe Join our discord

    test

    Administrator Village Drunk

    Compiler problem

    The 'black screen' is just the console window.

    Hit up start->run, type cmd.exe into the box and press enter.

    You'll need to learn to use win32 command prompt if you want to be any sort of real programmer.

    At a random search the following tutorial came up:
    http://www.febooti.com/products/command-line-email/batch-files/ms-dos-prompt-introduction.html
     
  13. Unread #7 - Dec 20, 2009 at 11:43 AM
  14. super_
    Joined:
    Dec 20, 2008
    Posts:
    91
    Referrals:
    0
    Sythe Gold:
    0

    super_ Member

    Compiler problem

    lol'd: dev-c++, digital mars compiler
    oh my... ps system("pause"); is bloody disgusting
     
  15. Unread #8 - Dec 20, 2009 at 9:16 PM
  16. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Compiler problem

    Agreed.

    I suggest you try a more capable IDE like Code::Blocks. Also, never use System("pause");, use one of the stdio functions to take input from the person. Even so, I think CodeBlocks halts its own console when the program has finished executing.
     
  17. Unread #9 - Jan 13, 2010 at 12:39 PM
  18. Eduard
    Joined:
    May 26, 2006
    Posts:
    45
    Referrals:
    1
    Sythe Gold:
    0

    Eduard Member
    Banned

    Compiler problem

    What happends in the code?

    Code:
    int main()
    {
    // code 
    return 0; // it returns 0, INT <-- main(). it after it has succeed it quits. so does the program. 
    }
    
    solve?
    
    int main()
    {
    //blabla
    getchar();
    return 0;
    }
    
    or 
    
    int main()
    {
    system("PAUSE");
    return 0;
    }
    
    or 
    
    use cmd.exe
    
     
< Email | Quick help needed >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site