2016-09-22 54 views
1

我在VS 2015上創建了一個默認的空項目,並將警告設置爲/Wall。我有以下的單個源文件:爲空主()生成的警告

#pragma warning(push, 3)   
#include <functional> 
#pragma warning(pop) 

//#pragma warning(disable : 4710) 
int main() 
{ 

} 

我收到以下錯誤:

1>c:\users\flatmouse\documents\visual studio 2015\projects\project72\project72\source.cpp(10): warning C4710: 'std::exception_ptr std::exception_ptr::_Current_exception(void) throw()': function not inlined 
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\exception(299): note: see declaration of 'std::exception_ptr::_Current_exception' 
1>c:\users\flatmouse\documents\visual studio 2015\projects\project72\project72\source.cpp(10): warning C4710: 'std::exception_ptr std::current_exception(void) noexcept': function not inlined 
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\exception(358): note: see declaration of 'std::current_exception' 

接下來,我試圖通過彈出移動到保持在3警告級別的所有源代碼最後一行:

#pragma warning(push, 3)   
#include <functional> 

//#pragma warning(disable : 4710) 
int main() 
{ 

} 
#pragma warning(pop) 

但我仍然得到相同的錯誤。

爲什麼警告仍然報告?

+0

/Wall再次觸發([here](http:// stackoverflow .COM /問題/ 39603207/MSVC-2015-牆上有-很多 - 的 - 不有用的消息))。 –

+0

[有人跑過這個昨天幾乎就是這個](http://stackoverflow.com/questions/39603207/msvc-2015-wall-has-lots-of-not-useful-messages)。即使您在上面的編譯指示中用較低的警告級別阻止了它們,Wall也會在包含中顯示一些簡單的警告。看起來不像任何人有一個好的答案。 – user4581301

+2

@RobertPrévost是的。排隊Pink Floyd。 – user4581301

回答

2

使用Visual C++使用/W4而不是/Wall。後者只是要求一堆愚蠢的警告。它曾經是/W4會爲Windows API和C++標準庫標題提供雪崩警告,但是幸好這與Visual C++ 2015不同。

相關問題