Is there a way to disable all warnings with a pragma?

前端 未结 4 1100
遇见更好的自我
遇见更好的自我 2020-12-14 05:44

I\'ve started a new project and have decided to make sure it builds cleanly with the /Wall option enabled. The only problem is not all 3rd party libraries (like boost) compi

4条回答
  •  执念已碎
    2020-12-14 06:25

    What I've done before is set the "W3" option rather than "Wall" then in each of my own source .cpp files I put

    #pragma warning(push, 4)
    

    at the top AFTER all the "#include..." lines and then

    #pragma warning(pop)
    

    as the very last line of the file.

    This way you get level 4 warnings in your code and level 3 in 3rd party code that you can't do anything about.

提交回复
热议问题