Visual Studio compiles but the exe isn't there

2019-06-15 18:50发布

问题:

Source code that compiles fine on other peoples environments won't correctly work in my environment. When I do a rebuild the compile occurs but when visual studio goes to move the exe from /obj/debug/{solution} to /debug/{solution} it cannot find the exe in the /obj/debug/{solution}. To make this even more crazy even after I reinstall visual studio it doesn't work. On other people environments it works find. Please note that this is a windows mobile 6, compact framework 3.5 project, Visual C++ project.

EDIT: Visual Studio 2008 is being used.

EDIT2: After looking at the logs again come to find out it says it is compiling but it isn't really compiling. Interesting enough it doesn't throw any errors until it tries to link the code. When it goes to link the object files, they aren't there and it fails.

回答1:

I got TWO Release folders: one in the solution folder and one in the project folder. The former contains the .exe file, the latter does not.



回答2:

In the solution properties page, check whether the path you are expecting the exe to be is same as the one specified in Linker -> Output file.

Another obvious mistake could be, check what build configuration you are building. You might be doing a release build and expecting a debug executable file :) I have done this a few times.



回答3:

Maybe VS creates the exe, and before it tries to move it to the final destination your virus scanner grabs it and removes it, or moves it to a save location.



回答4:

I just wanted to chime in and ask: have you looked for the *.exe file name from the directories above? What I found in my case was it was writing to the directory right above the /release subdirectory. Not sure how I missed that detail, but I did! I suppose it never occurred to me earlier because I saw the buildlog.htm being written to the /release subdirectory, and the very existence of the directory itself. In my case it was compiling, linking, etc. I just wasn't able to see the *.exe in that /release subdirectory.



回答5:

If the exact same solution works on other machines, then it's an environment problem and no amount of looking at the project, linker, etc is going to resolve this. What is different about the environments? Are the same service packs and QFE's applied for not just Studio, but also the OS? Is there a difference in processors (64/32-bit)? Are your permissions the same? Do you have the same SDKs installed?

I'd agree with Shahi that just trying to build a "hello world" app against the same SDK and see if it will compile is valuable info.



回答6:

If you create a new "hello world" WM project, does it work?

If so, you can compare the solution files to check for differences that can cause this.



回答7:

Perhaps you do not have write permission to the output folder? If you are running on Vista/7, is your Visual Studio running as elevated?



回答8:

As far as I could tell, you need to "Save All" before building.



回答9:

I had exactly the same problem. Just close Visual Studio and reopen it again (basically restart it) and it should work.



回答10:

I've found this to be random for myself in now VS2016. My work around has been to just create another project and copy the contents from the one with out the .exe to the new one. For some reason the new one normally will have the proper .exe and location needed. While this isn't a complete solution at least it's been working for me for the time being.