Dev-C++ Program Compilation Troubleshooting

Click For Summary

Discussion Overview

The discussion focuses on troubleshooting issues related to program compilation and execution in Dev-C++. Participants explore reasons why the command prompt closes immediately after running a program, suggesting various methods to keep the console window open.

Discussion Character

  • Technical explanation, Homework-related

Main Points Raised

  • One participant reports that the command prompt opens briefly and then closes when running a program in Dev-C++, seeking assistance.
  • Another participant suggests using the command prompt directly to navigate to the program's directory and run it from there.
  • Some participants propose using functions like getch() or getchar() to pause the program execution, allowing the console window to remain open until user input is received.

Areas of Agreement / Disagreement

Participants present multiple approaches to address the issue, but there is no consensus on a single solution. Various methods are suggested without agreement on which is most effective.

Contextual Notes

Some suggestions depend on the specific environment (e.g., Windows XP) and may not apply universally. The effectiveness of using getch() or getchar() may vary based on the program's context and requirements.

JamesU
Gold Member
Messages
828
Reaction score
3
Every time I compile and run a program in Dev-C++ Command prompt only opens for less than a second and closes immediately. can anyone help?
 
Technology news on Phys.org
START->RUN

Type: cmd (assuming your on windows xp)
Type: cd <directory where program is located>
Type: <program name>
 
Use getch() ?
Code:
#include<stdio.h>
#include<conio.h>
int main()
{
    printf("Hello World");
    getch();
    return 0;
}

-- AI
 
Programs run until they get to the end of the code, use getchar()
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
14
Views
4K
Replies
6
Views
4K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 16 ·
Replies
16
Views
3K