我正在尝试编译并运行此GUI代码
#include "Graph.h" // get access to our graphics library facilities
int main()
{
using namespace Graph_lib; // our graphics facilities are in Graph_lib
Point tl{ 100,100 }; // to become top left corner of window
Simple_window win{ tl,600,400,"Canvas" }; // make a simple window
Polygon poly; // make a shape (a polygon)
poly.add(Point{ 300,200 }); // add a point
poly.add(Point{ 350,100 }); // add another point
poly.add(Point{ 400,200 }); // add a third point
poly.set_color(Color::red); // adjust properties of poly
win.attach(poly); // connect poly to the window
win.wait_for_button(); // give control to the display engine
}
标头和代码文件的来源:http://www.stroustrup.com/Programming/PPP2code/
我收到hash_map错误
Error (active) E0035 #error directive: <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. ConsoleApplication1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\hash_map 21
是什么导致hash_map错误,如何解决?
最佳答案
hash_map
是c ++ 11规范之前的旧API,他们决定该容器的名称为unordered_map
。您需要改为使用该名称。
关于c++ - 是什么导致hash_map错误,如何解决?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59582015/