my program does not display in command prompt when i run it (even when the codes are correct, I tested with the simplest program of all- Hello World). I usually work with Code Blocks, I thought that was the problem but encountered the same problem with DEV C++. I have followed a couple of instruction online to get the problem resolved using Dev C++, the problem persist. Please help See attached picture.
Asked
Active
Viewed 215 times
-3
-
3Please post a [Minimal complete verifiable example.](http://stackoverflow.com/help/mcve) – Fantastic Mr Fox Dec 30 '15 at 01:50
-
Does it work if you run the program directly from the console, without any IDE? – molbdnilo Dec 30 '15 at 01:50
-
Related to http://stackoverflow.com/questions/1107705/systempause-why-is-it-wrong -- really, Microsoft Windows is simply not the best platform for learning C++ development (let the flame wars begin!) – Sam Varshavchik Dec 30 '15 at 01:50
-
@SamVarshavchik How dare you! Windows is the best platform for learning anything! Arrgh... – Ivan Aksamentov - Drop Dec 30 '15 at 02:01
-
@Dotun You either forgot to recompile or there is that kind of mistake. It's not really related to C++ and, especially, [compiler-construction] – Ivan Aksamentov - Drop Dec 30 '15 at 02:02
-
There's too little info to go on to say how exactly you're using the IDE incorrectly. But here's a way to get progress: *use the compiler from the Windows command line, cmd.exe*. That way you ensure that you're actually compiling your source, and that you're actually running your program, and you get error messages if you don't get this right. – Cheers and hth. - Alf Dec 30 '15 at 02:03
-
@Ben: it's a standard hello world with no pause. – Cheers and hth. - Alf Dec 30 '15 at 02:04
-
@Cheersandhth.-Alf Yeah i saw the picture, but its not exactly verifiable: http://ideone.com/Lt8NIb, point is, too little info. – Fantastic Mr Fox Dec 30 '15 at 02:05
-
@Ben Heh. You haven't reproduced it properly. You need Windows 10, Dev C++ 5.4 and a project created on the path shown in the title bar. ;) – Ivan Aksamentov - Drop Dec 30 '15 at 02:07
-
@Drop: Oh! Maybe it's the spaces in the paths. As I recall Code::Blocks has a problem with path spaces, and maybe then also DevC++? – Cheers and hth. - Alf Dec 30 '15 at 02:17
-
Yet another avast problem? Or did I guess the issue wrong? – drescherjm Dec 30 '15 at 02:20
-
@Dotun Also notice that executable path and filename (in console window's title bar) are very different from the project path and name. You might confuse executable etc. – Ivan Aksamentov - Drop Dec 30 '15 at 02:21
-
@drescherjm Haha. Avast and AVG is more like anti-VisualStudio things. Do they also mess with MinGW? – Ivan Aksamentov - Drop Dec 30 '15 at 02:22
-
They mess with unknown executables. Any program you compile will be in that category.. I have seen at least a dozen threads were avast was the cause of the can't run my c++ program in the last 3 or so days. – drescherjm Dec 30 '15 at 02:23
-
Thanks Guys, AVAST was the problem. i turned off firewall and real-time shield, BOOM!!! my program appeared. – Dotun Ojelabi Dec 30 '15 at 16:19
-
Possible duplicate of [Running my c++ code gives me a blank console](http://stackoverflow.com/questions/33690697/running-my-c-code-gives-me-a-blank-console) – drescherjm Dec 31 '15 at 15:12
1 Answers
1
There may be several reasons why the console application run from IDE does not show message. I am trying to consider some of them.
- Your program ends immediately after start and printed text disappears for some reason (in some IDE console window for your code will appear for a fraction of a second) Add some code that will wait input, e.g.:
#include <iostream>
using namespace std;
int main(void)
{
int number;
cout << "Enter a number, please" << endl;
cin >> number;
return 0;
}
Your IDE executes previously compiled program that was build from source code without any output. Try to clean current project and then rebuild it again (or create new project with the same code)
Perhaps, properties of your console window do not allow you to see printed text. Make sure that Screen text color is set to light (Move mouse arrow to top-left corner of console screen -> right-click -> properties -> colors tab -> Screen text option -> select a color)

VolAnd
- 6,367
- 3
- 25
- 43