【发布时间】:2019-03-08 06:50:58
【问题描述】:
我最近安装了 Microsoft Visual Studio 2017。每当我尝试编译我的 C 代码时,我都会收到一条错误消息,提示:
Unable to start program.
"c:\users\myname\source\repos\ConsoleApplication2\Debug\ConsoleApplication2.exe'.
The system cannot find the file specified.
我通过选择编写代码, 文件 > 新项目 > Windows 控制台应用程序 > 源文件(右键单击)> 添加 > 新项目 > 文件名.c
为了进行编译,我使用本地 Windows 调试器并从高级属性选项编译为 C 代码 (/TC)。
如何使我的程序正常运行?我的代码是正确的,因为它可以完美地在另一个 IDE 中编译。
【问题讨论】:
-
这是一个很常见的问题,搜索“visual Unable to start program. the system cannot find the file specified.”,你会得到很多答案。
-
你的vs2017版本是什么,15.7.3之后,如果我们创建windows控制台应用程序,首先我们需要删除源文件下的pch.h和所有.cpp文件。之后,将“Precompiled Header”更改为“Not using...”。
-
确保在使用本地 Windows 调试器之前成功构建项目。另外,创建一个新项目怎么样,这个问题仍然存在吗?您可以尝试使用this 之后的另一种方式创建项目。
-
@LanceLi-MSFT 非常感谢!!那个视频解决了一切!!!
标签: c visual-studio-2017 ide