.exe files disappear

I was trying to make a new program, but when I build it and run it, the console pops up with nothing on it and as soon as I run the program the .exe file disappears immediately. This only happens to new programs. I have some older ones that work. I've tried different compilers and it still does the same thing. This only started happening to me today. If I make the program in the same folder as one of my older programs, it builds normally, but if I move it anywhere else it doesn't work. Has anyone else experienced this before? How do I fix it? Thanks!
closed account (Dy7SLyTq)
it could be an ide thing. if you want it to stay open then google pausing your program c++
closed account (13bSLyTq)
Hi,

use std::cin.get();

Simply place:

 
std::cin.get();


at the bit you wish to pause.
This sounds like you are trying to describe two different issues at once. When an executable you compile automatically disappear after you try to run it that is usually due to an over zealous antivirus program. There is normally a pop-up notification when this occurs but if for some reason some bone head disabled this them on your system then you can at least check the AV logs to see if anything registered there.

If I make the program in the same folder as one of my older programs, it builds normally, but if I move it anywhere else it doesn't work.

This part makes it sound like you are dynamically linking using a relative path. Do you know if your code does this anywhere? If so can you change it to a fully qualified path instead? What IDE are you using and what kind of project are you trying to build? If you are not using an IDE then what are you passing to the linker and then compiler on the command line?



closed account (Dy7SLyTq)
@orionmaster: that only works if the buffer is clear. it can work, but you can write a pause function that would work much better. for example im using linux and found a class that i modified to turn the buffer off and then do nothing until they actually hit the keyboard again then turns the buffer on again
If you want to see the output of your command line executable then launch it from the command line. Copy the path to the executable then open a command prompt and type "cd<space> ", right click inside of the window and select "paste" then press enter.

But it does not sound like this is simply a matter of holding the window open. If it was then why would moving the executable to an older project folder change anything in the code?
Thank you for your replies. It seems like Malwarebytes was the issue. It has never done this before... Now I can run my programs normally.
Topic archived. No new replies allowed.