【问题标题】:The system cannot find the file specified Visual Studio 2015系统找不到Visual Studio 2015指定的文件
【发布时间】:2017-06-20 20:21:32
【问题描述】:

我刚开始编程,但我不断遇到标题和内容方面的问题。 所以,每当我尝试运行代码时

 // ConsoleApplication4.cpp : Defines the entry point for the console      application.
#include "stdafx.h"
#include "std_lib_facilities.h"

int main()
{
    return 0;
}

我收到这个警告说

无法启动程序“C:\Users\Gebruiker\documents\visual studio 2015\Projects\ConsoleApplication4\Debug\ConsoleApplication4.exe”。 系统找不到指定的文件。

此外,构建输出:

1>------ Build started: Project: ConsoleApplication4, Configuration: Debug Win32 ------
1>ConsoleApplication4.cpp
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========_

您可能已经注意到,我正在关注 Bjarne Stroustrup 关于这方面的书,但他根本没有具体说明如何处理这个问题。

无论如何,std_lib_facilities.h 头文件与 ConsoleApplication.cpp 位于同一文件夹中,正如他告诉我的那样。

我实际上并不认为这与这个程序有任何关系,因为我在做的所有项目中都面临这个问题。

哦,是的,我不得不说我已经检查了多个与此相关的问题,但这些问题与我的不匹配。

我也尝试了#include "../std_lib_facilities.h"#include "../../std_lib_facilities.h",但没有结果。(与 stdafx.h 相同)我尝试“构建”程序,但我实际上并不知道那是做什么的,我是否应该构建解决方案或 cpp,以及何时调试......

答案肯定不在书中,因为我已经继续阅读第 8 章,没有做练习,因为我无法让事情发挥作用。

(如果我在这个问题上搞砸了,也请告诉我,我需要少说话,提供更多细节或其他东西)

【问题讨论】:

标签: c++ c++11 visual-c++ visual-studio-2015


【解决方案1】:

以下是删除弃用错误的方法: How to fix "<hash_map> is deprecated and will be REMOVED. Please use <unordered_map>"?

如果它仍然没有运行,只需转到项目目录并删除 Visual Studio 在使用 Debug\Release 配置运行后创建的所有 Debug\Release 文件夹。通常对我有用。

【讨论】:

    【解决方案2】:

    尝试创建“新项目”/C++ 控制台应用程序;使用您的代码并且没有任何包含语句。 - Peter K

    这为我解决了这个问题,我基本上只是复制粘贴了代码,它就可以工作了。

    我也遇到了 hash_map 错误,因为 MSVS 2017 不再支持它。 这种情况尤其发生,因为人们仍然经常在 Bjarne Stroustrup 的网站上找到旧标题。这是Baum Mit Augen提供的new header的链接(Stroustrup的更新版本)

    如果您使用的不是 Bjarne Stroustrup 提供的标题,而是您自己制作的标题、您在 Internet 上找到的标题或书籍提供的标题,请关注 WindyFields 先前回答中的 this tutorial。 (非常感谢)(如果这不能解决问题,请务必查看他们的答案)

    如果你遇到这个问题,可能是你在新建项目时弄乱了设置(比如我)。

    这是社区提供的cmets的浓缩,这些答案都不是我的。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-01
    • 2021-08-08
    相关资源
    最近更新 更多