IN VS 2010 Pro我得到一個編譯錯誤,指出「expected標識符「在命令的max()部分。看來在windows.h頭文件中有一個max(a,b)標識並且它想要使用它。std :: cin.ignore(std :: numeric_limits <std :: streamsize> :: max(),' n')使用時出現錯誤#include <Windows.h>
我試圖使用的#include以及但這並沒有解決問題
反正是有解決這個問題?
IN VS 2010 Pro我得到一個編譯錯誤,指出「expected標識符「在命令的max()部分。看來在windows.h頭文件中有一個max(a,b)標識並且它想要使用它。std :: cin.ignore(std :: numeric_limits <std :: streamsize> :: max(),' n')使用時出現錯誤#include <Windows.h>
我試圖使用的#include以及但這並沒有解決問題
反正是有解決這個問題?
<windows.h>
頭文件自古以來就有min()
和max()
宏,並且它們經常會導致C++出現問題。幸運的是,您可以在包括<windows.h>
之前添加#define NOMINMAX
以禁用它們。
你的答案比我的好。 –
[std :: max - expected a identifier]可能的重複(http://stackoverflow.com/questions/7035023/stdmax-expected-an-identifier) – ildjarn
另一個重複[macro「max」需要2個參數,但是隻有1給出](http://stackoverflow.com/questions/518517/macro-max-requires-2-arguments-but-only-1-given) – jrok