My C/C++ program immediately close after run. Have to run with ConsolePauser.exe [closed]How can I profile C++ code running on Linux?Preventing console window from closing on Visual Studio C/C++ Console applicationC++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Eclipse (c++) doesn't run programsComodo internet security detect c++ hello world program as a viruses (trojan)C++ program won't print to cout in XcodeVisual 2015 C++ Program Not Running, Deubugging Symbols issue?Visual Studio 2015 - Local Windows Debugger closes out immediately after run?Windows console closing immediately after running a c++ codeTracing calls to std::cout
"Estrontium" on poster
Two (probably) equal real numbers which are not proved to be equal?
Has everyone forgotten about wildfire?
Not taking the bishop with the knight, why?
Why is there a cap on 401k contributions?
What is the status of the three crises in the history of mathematics?
Using wilcox.test() and t.test() in R yielding different p-values
Is there an application which does HTTP PUT?
Row vectors and column vectors (Mathematica vs Matlab)
How do carbureted and fuel injected engines compare in high altitude?
TeX Gyre Pagella Math Integral sign much too small
Why do the Avengers care about returning these items in Endgame?
Employee is self-centered and affects the team negatively
What's the "magic similar to the Knock spell" referenced in the Dungeon of the Mad Mage adventure?
What is the Ancient One's mistake?
Do Rabbis admit emotional involvement in their rulings?
How does weapons training transfer to empty hand?
Does Thread.yield() do anything if we have enough processors to service all threads?
Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1
Why did Missandei say this?
How come mathematicians published in Annals of Eugenics?
Pre-1993 comic in which Wolverine's claws were turned to rubber?
Is every story set in the future "science fiction"?
What can cause an unfrozen indoor copper drain pipe to crack?
My C/C++ program immediately close after run. Have to run with ConsolePauser.exe [closed]
How can I profile C++ code running on Linux?Preventing console window from closing on Visual Studio C/C++ Console applicationC++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Eclipse (c++) doesn't run programsComodo internet security detect c++ hello world program as a viruses (trojan)C++ program won't print to cout in XcodeVisual 2015 C++ Program Not Running, Deubugging Symbols issue?Visual Studio 2015 - Local Windows Debugger closes out immediately after run?Windows console closing immediately after running a c++ codeTracing calls to std::cout
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Sorry for bad English and I'm new at programming. I'm just 16.
I use dev-c++.
The Anti-virus (AVG) showed me something but I didn't really care after I compile and run the program then it ran and closed.
Then I looked in the quarantine in the anti-virus it shows that csrss.exe has quarantined. I don't know that it's involved or not. But I have restored it but it can't restore to the original path, then I restore it to desktop and the ConsolePauser.exd appears.
If I run my C or C++ program with dev-c++ button run, it just opens and closes immediately. But if I drag the .exe C program to ConsolePauser.exe to open as.
It runs normally.
https://imgur.com/mtEAVen "what's showed in anti-virus"
https://imgur.com/RuWEari "This is ConsolePauser.exe"
Please help me fix this. Thank you
I've tried close Anti-virus but nothing happens.
I uninstalled the Anti-virus.
#include <iostream>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
return 0;
It just opens and close immediately. Even a simple Hello World.
c++ c console
closed as off-topic by Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen♦ Mar 24 at 1:28
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen
|
show 18 more comments
Sorry for bad English and I'm new at programming. I'm just 16.
I use dev-c++.
The Anti-virus (AVG) showed me something but I didn't really care after I compile and run the program then it ran and closed.
Then I looked in the quarantine in the anti-virus it shows that csrss.exe has quarantined. I don't know that it's involved or not. But I have restored it but it can't restore to the original path, then I restore it to desktop and the ConsolePauser.exd appears.
If I run my C or C++ program with dev-c++ button run, it just opens and closes immediately. But if I drag the .exe C program to ConsolePauser.exe to open as.
It runs normally.
https://imgur.com/mtEAVen "what's showed in anti-virus"
https://imgur.com/RuWEari "This is ConsolePauser.exe"
Please help me fix this. Thank you
I've tried close Anti-virus but nothing happens.
I uninstalled the Anti-virus.
#include <iostream>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
return 0;
It just opens and close immediately. Even a simple Hello World.
c++ c console
closed as off-topic by Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen♦ Mar 24 at 1:28
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen
Pretty sure it's a bad idea uninstalling the virus scanner... If it makes trouble, then you should allow an exception for your little programme. You should find that somewhere in your AV settings.
– Aconcagua
Mar 23 at 8:47
To enable us to tell anything concrete, you should provide the code – please have a look at How to Ask and Minimal, Complete, and Verifiable example.
– Aconcagua
Mar 23 at 8:58
If you've written a 'standard' hello world à laint main() std::cout << "hello world"; return 0;
, then your programme runs, prints the output and terminates. If you start it via a double click under windows, then the OS by default opens a console window that remains open as long as the programme runs – which is very short, of course. I don't know ConsolePauser, but most likely it keeps the console artificially open even after your programme having terminated already long ago...
– Aconcagua
Mar 23 at 9:00
1
Try addingstd::cin.get();
beforereturn 0;
. It should compel the console to let you press enter before terminating.
– TrebledJ
Mar 23 at 9:11
2
@MeisterAP every PC running windows will close it as soon as it’s finished. Don’t do as Trebled says, just open a command promt and run the program from there, then the command prompt will not close.
– Fredrik
Mar 23 at 9:14
|
show 18 more comments
Sorry for bad English and I'm new at programming. I'm just 16.
I use dev-c++.
The Anti-virus (AVG) showed me something but I didn't really care after I compile and run the program then it ran and closed.
Then I looked in the quarantine in the anti-virus it shows that csrss.exe has quarantined. I don't know that it's involved or not. But I have restored it but it can't restore to the original path, then I restore it to desktop and the ConsolePauser.exd appears.
If I run my C or C++ program with dev-c++ button run, it just opens and closes immediately. But if I drag the .exe C program to ConsolePauser.exe to open as.
It runs normally.
https://imgur.com/mtEAVen "what's showed in anti-virus"
https://imgur.com/RuWEari "This is ConsolePauser.exe"
Please help me fix this. Thank you
I've tried close Anti-virus but nothing happens.
I uninstalled the Anti-virus.
#include <iostream>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
return 0;
It just opens and close immediately. Even a simple Hello World.
c++ c console
Sorry for bad English and I'm new at programming. I'm just 16.
I use dev-c++.
The Anti-virus (AVG) showed me something but I didn't really care after I compile and run the program then it ran and closed.
Then I looked in the quarantine in the anti-virus it shows that csrss.exe has quarantined. I don't know that it's involved or not. But I have restored it but it can't restore to the original path, then I restore it to desktop and the ConsolePauser.exd appears.
If I run my C or C++ program with dev-c++ button run, it just opens and closes immediately. But if I drag the .exe C program to ConsolePauser.exe to open as.
It runs normally.
https://imgur.com/mtEAVen "what's showed in anti-virus"
https://imgur.com/RuWEari "This is ConsolePauser.exe"
Please help me fix this. Thank you
I've tried close Anti-virus but nothing happens.
I uninstalled the Anti-virus.
#include <iostream>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
return 0;
It just opens and close immediately. Even a simple Hello World.
c++ c console
c++ c console
edited Mar 23 at 9:09
MeisterAP
asked Mar 23 at 8:39
MeisterAPMeisterAP
32
32
closed as off-topic by Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen♦ Mar 24 at 1:28
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen
closed as off-topic by Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen♦ Mar 24 at 1:28
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Mat, πάντα ῥεῖ, Weather Vane, Baum mit Augen
Pretty sure it's a bad idea uninstalling the virus scanner... If it makes trouble, then you should allow an exception for your little programme. You should find that somewhere in your AV settings.
– Aconcagua
Mar 23 at 8:47
To enable us to tell anything concrete, you should provide the code – please have a look at How to Ask and Minimal, Complete, and Verifiable example.
– Aconcagua
Mar 23 at 8:58
If you've written a 'standard' hello world à laint main() std::cout << "hello world"; return 0;
, then your programme runs, prints the output and terminates. If you start it via a double click under windows, then the OS by default opens a console window that remains open as long as the programme runs – which is very short, of course. I don't know ConsolePauser, but most likely it keeps the console artificially open even after your programme having terminated already long ago...
– Aconcagua
Mar 23 at 9:00
1
Try addingstd::cin.get();
beforereturn 0;
. It should compel the console to let you press enter before terminating.
– TrebledJ
Mar 23 at 9:11
2
@MeisterAP every PC running windows will close it as soon as it’s finished. Don’t do as Trebled says, just open a command promt and run the program from there, then the command prompt will not close.
– Fredrik
Mar 23 at 9:14
|
show 18 more comments
Pretty sure it's a bad idea uninstalling the virus scanner... If it makes trouble, then you should allow an exception for your little programme. You should find that somewhere in your AV settings.
– Aconcagua
Mar 23 at 8:47
To enable us to tell anything concrete, you should provide the code – please have a look at How to Ask and Minimal, Complete, and Verifiable example.
– Aconcagua
Mar 23 at 8:58
If you've written a 'standard' hello world à laint main() std::cout << "hello world"; return 0;
, then your programme runs, prints the output and terminates. If you start it via a double click under windows, then the OS by default opens a console window that remains open as long as the programme runs – which is very short, of course. I don't know ConsolePauser, but most likely it keeps the console artificially open even after your programme having terminated already long ago...
– Aconcagua
Mar 23 at 9:00
1
Try addingstd::cin.get();
beforereturn 0;
. It should compel the console to let you press enter before terminating.
– TrebledJ
Mar 23 at 9:11
2
@MeisterAP every PC running windows will close it as soon as it’s finished. Don’t do as Trebled says, just open a command promt and run the program from there, then the command prompt will not close.
– Fredrik
Mar 23 at 9:14
Pretty sure it's a bad idea uninstalling the virus scanner... If it makes trouble, then you should allow an exception for your little programme. You should find that somewhere in your AV settings.
– Aconcagua
Mar 23 at 8:47
Pretty sure it's a bad idea uninstalling the virus scanner... If it makes trouble, then you should allow an exception for your little programme. You should find that somewhere in your AV settings.
– Aconcagua
Mar 23 at 8:47
To enable us to tell anything concrete, you should provide the code – please have a look at How to Ask and Minimal, Complete, and Verifiable example.
– Aconcagua
Mar 23 at 8:58
To enable us to tell anything concrete, you should provide the code – please have a look at How to Ask and Minimal, Complete, and Verifiable example.
– Aconcagua
Mar 23 at 8:58
If you've written a 'standard' hello world à la
int main() std::cout << "hello world"; return 0;
, then your programme runs, prints the output and terminates. If you start it via a double click under windows, then the OS by default opens a console window that remains open as long as the programme runs – which is very short, of course. I don't know ConsolePauser, but most likely it keeps the console artificially open even after your programme having terminated already long ago...– Aconcagua
Mar 23 at 9:00
If you've written a 'standard' hello world à la
int main() std::cout << "hello world"; return 0;
, then your programme runs, prints the output and terminates. If you start it via a double click under windows, then the OS by default opens a console window that remains open as long as the programme runs – which is very short, of course. I don't know ConsolePauser, but most likely it keeps the console artificially open even after your programme having terminated already long ago...– Aconcagua
Mar 23 at 9:00
1
1
Try adding
std::cin.get();
before return 0;
. It should compel the console to let you press enter before terminating.– TrebledJ
Mar 23 at 9:11
Try adding
std::cin.get();
before return 0;
. It should compel the console to let you press enter before terminating.– TrebledJ
Mar 23 at 9:11
2
2
@MeisterAP every PC running windows will close it as soon as it’s finished. Don’t do as Trebled says, just open a command promt and run the program from there, then the command prompt will not close.
– Fredrik
Mar 23 at 9:14
@MeisterAP every PC running windows will close it as soon as it’s finished. Don’t do as Trebled says, just open a command promt and run the program from there, then the command prompt will not close.
– Fredrik
Mar 23 at 9:14
|
show 18 more comments
1 Answer
1
active
oldest
votes
there is to way to solve this problem
first :
you should add Windows.h header file and before return 0 at the end add this command
system("pause");
some thing like this code :
#include <iostream>
#include <Windows.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
system("pause");
return 0;
the second way to solve the problem is using header file conio.h and add _getch(); command line before return 0
something like this code :
#include <iostream>
#include <conio.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
_getch();
return 0;
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
there is to way to solve this problem
first :
you should add Windows.h header file and before return 0 at the end add this command
system("pause");
some thing like this code :
#include <iostream>
#include <Windows.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
system("pause");
return 0;
the second way to solve the problem is using header file conio.h and add _getch(); command line before return 0
something like this code :
#include <iostream>
#include <conio.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
_getch();
return 0;
add a comment |
there is to way to solve this problem
first :
you should add Windows.h header file and before return 0 at the end add this command
system("pause");
some thing like this code :
#include <iostream>
#include <Windows.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
system("pause");
return 0;
the second way to solve the problem is using header file conio.h and add _getch(); command line before return 0
something like this code :
#include <iostream>
#include <conio.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
_getch();
return 0;
add a comment |
there is to way to solve this problem
first :
you should add Windows.h header file and before return 0 at the end add this command
system("pause");
some thing like this code :
#include <iostream>
#include <Windows.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
system("pause");
return 0;
the second way to solve the problem is using header file conio.h and add _getch(); command line before return 0
something like this code :
#include <iostream>
#include <conio.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
_getch();
return 0;
there is to way to solve this problem
first :
you should add Windows.h header file and before return 0 at the end add this command
system("pause");
some thing like this code :
#include <iostream>
#include <Windows.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
system("pause");
return 0;
the second way to solve the problem is using header file conio.h and add _getch(); command line before return 0
something like this code :
#include <iostream>
#include <conio.h>
#include <string>
int main()
std::cout << "Hello World!" << std::endl;
_getch();
return 0;
answered Mar 23 at 10:20
meysamimanimeysamimani
161
161
add a comment |
add a comment |
Pretty sure it's a bad idea uninstalling the virus scanner... If it makes trouble, then you should allow an exception for your little programme. You should find that somewhere in your AV settings.
– Aconcagua
Mar 23 at 8:47
To enable us to tell anything concrete, you should provide the code – please have a look at How to Ask and Minimal, Complete, and Verifiable example.
– Aconcagua
Mar 23 at 8:58
If you've written a 'standard' hello world à la
int main() std::cout << "hello world"; return 0;
, then your programme runs, prints the output and terminates. If you start it via a double click under windows, then the OS by default opens a console window that remains open as long as the programme runs – which is very short, of course. I don't know ConsolePauser, but most likely it keeps the console artificially open even after your programme having terminated already long ago...– Aconcagua
Mar 23 at 9:00
1
Try adding
std::cin.get();
beforereturn 0;
. It should compel the console to let you press enter before terminating.– TrebledJ
Mar 23 at 9:11
2
@MeisterAP every PC running windows will close it as soon as it’s finished. Don’t do as Trebled says, just open a command promt and run the program from there, then the command prompt will not close.
– Fredrik
Mar 23 at 9:14