“The system cannot find the file specified” when running C++ program

后端 未结 12 1688
庸人自扰
庸人自扰 2020-11-29 08:30

I installed Visual Studio 2010. I wrote a simple code which I\'m sure is correct but unfortunately, when I run the code, I get the error below.

Here is my code:

12条回答
  •  执笔经年
    2020-11-29 09:02

    As others have mentioned, this is an old thread and even with this thread there tends to be different solutions that worked for different people. The solution that worked for is as follows:

    Right Click Project Name > Properties
    Linker > General 
    Output File > $(OutDir)$(TargetName)$(TargetExt) as indicated by @ReturnVoid
    Click Apply
    

    For whatever reason this initial correction didn't fix my problem (I'm using VS2015 Community to build c++ program). If you still get the error message try the following additional steps:

    Back in Project > Properties > Linker > General > Output File > 
    

    You'll see the previously entered text in bold

    Select Drop Down > Select "inherit from parent or project defaults"
    Select Apply
    

    Previously bold font is no longer bold

    Build > Rebuild > Debug
    

    It doesn't make since to me to require these additional steps in addition to what @ReturnVoid posted but...what works is what works...hope it helps someone else out too. Thanks @ReturnVoid

提交回复
热议问题