Reputation: 63
I'm still learning c++ and I probably made something stupid ;)
My Visual Studio Project builds without error or warnings (in debugmode) but I can't run it. When I hit F5 a unhelpful error message pops up: "Unable to start program:'Path\foo.exe'". It turned out that there is simply no exe file in the build folder.
I pointed out that when I build the project the exe shows up for a short amount of time and then disappears again.
This part of my code causes the described problem:
void foo::start(){
std::vector<variation> variations;
...
}
heres the variation struct:
struct variation {
int rest;
};
what am I doing wrong?
edit: Process Monitor shows that most likeley explorer.exe removes the file (coudln't find the exakt entry but it's the only process runing after build)
after clean solution and new build sometimes the exe is permanently in the directory, when i double click on it following error appears: "'path\name.exe' is not a valid win32 application" does this mean my code does something which is ok by c++ standards but not by windows?
Upvotes: 1
Views: 2977
Reputation: 54393
I am so sure this is the answer that I am going to write it as an answer. But credit to Jerry Coffin and Hans Passant who were before me in the comments!
Antivirus. Turn it off or add your Visual Studio projects to its excluded directories.
I don't know your system's details but many AV programs are extremely suspicious of executable files that don't match a known checksum. Add to that some piece of code that matches a virus signature pattern and it freaks out, deleting or quarantining your program.
Although if that is the case I am surprised you don't get a warning message, flashing tray icon, or other form of alert. If your system was preinstalled by a company IT group, their administrators may be getting alerts from your system, with local alerts turned off.
Upvotes: 3