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;








-1















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.










share|improve this question















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
If this question can be reworded to fit the rules in the help center, please edit the question.
















  • 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(); before return 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

















-1















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.










share|improve this question















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
If this question can be reworded to fit the rules in the help center, please edit the question.
















  • 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(); before return 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













-1












-1








-1








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
If this question can be reworded to fit the rules in the help center, please edit the question.







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
If this question can be reworded to fit the rules in the help center, please edit the question.












  • 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(); before return 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











  • 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(); before return 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












1 Answer
1






active

oldest

votes


















-1














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;






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    -1














    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;






    share|improve this answer



























      -1














      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;






      share|improve this answer

























        -1












        -1








        -1







        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;






        share|improve this answer













        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;







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 10:20









        meysamimanimeysamimani

        161




        161















            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript