我正在使用 Codeblocks 17.12 并且已经将编译器设置设置为 C++11 标准。我正在学习 Bjarne Stroustrup 的书“编程 - 使用 C++ 的原则和实践”。在他的书中,他要求包括“std_lib_facilities.h”。我从他的网站复制它并保存在“Mingw”文件夹的“include”文件夹中。之后,我开始制作一个简单的程序:
#include<iostream>
#include "std_lib_facilities.h"
main()
{
std::cout<<"Hello world";
}
Run Code Online (Sandbox Code Playgroud)
但是编译器显示以下错误和警告:
Run Code Online (Sandbox Code Playgroud)warning: This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp] error: template-id 'do_get<>' for 'String > std::__cxx11::messages<char>::do_get(std::messages_base::catalog, int, …
我在Stroustrup网站上包含了std_lib。我的代码是:
#include "c:\Users\theresmineusername\Documents\Visual Studio 2017\std_lib_facilities.h"
int main()
{
cout << "Hello, World!\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
所以我有两个错误:
1. E1574 ??????????? ?????????? ?? ??????? ?? ??????? "<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." ConsoleApplication2 c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24930\include\hash_map
2. 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. ConsoleApplication2 c:\program files (x86)\microsoft …Run Code Online (Sandbox Code Playgroud)