• Log in or sign up for an account here: https://www.sythe.org/login

Compiler problem

Status
Not open for further replies.
Joined
Nov 27, 2005
Sythe Gold
0
Messages
1,789
Location
Florida
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.
 
Yeahh, does your script have return(0) or system("pause")

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

Please show me your script

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.
 
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.

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");
 
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");

holy shit thank you. im following a book on it and it didn't saying anything about a system("PAUSE"); but thank you.
 
Supporting Business
Discord Voice
Poképedia
Who did this to my freakin' car!
Dat Boi
Dolan Duck
Dolan Trump
I'm LAAAAAAAME
Live Free or Die
Mew
Mewtwo
PHP Shit Show 2k26
Poké Prizebox
Rust Player
Sythe Awards 2016 Winner
Sythe Awards 2017 Winner
Sythe Awards 2019 Winner
Tier 3 Prizebox
Toast Wallet User
holy shit thank you. im following a book on it and it didn't saying anything about a system("PAUSE"); but thank you.

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
 
lol'd: dev-c++, digital mars compiler
oh my... ps system("pause"); is bloody disgusting
 
Member of the Month Winner
Sythe's 10th Anniversary
lol'd: dev-c++, digital mars compiler
oh my... ps system("pause"); is bloody disgusting
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.
 
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
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top