Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to define _SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS macros?

I am developing TCP/IP program using Boost.Asio but I am getting error :

note: see declaration of 'std::allocator<void>' 1>d:\hardware\libraries\visual studio 2017\x64\include\boost\asio\use_future.hpp(137): error C4996: 'std::allocator<void>': warning STL4009: std::allocator<void> is deprecated in C++17. You can define
_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

After reading the error I understood that I have define

_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING

or

_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS

I define them once in Configuration Properties -> C/C++ -> General -> Additional #using Directories but error is still persistent.

Then I #defined booth the macros in main file before including any header but still the error persisted.

Then I declared the macro in my per-compiled herder but the error still persisted.

I even tried 2 different boost packages. One installed with vcpkg package manager and one pre-fill binary.

MSVC 14.1 x64 Boost : 1.68 (x64)

like image 420
Dark Sorrow Avatar asked Nov 07 '22 23:11

Dark Sorrow


1 Answers

Just Turning off "SDL checks" is all you need. Detail: property page of current project> 'c/c++'>'General'>'SDL checks' (VS2019, Win10 X64; 2021/01/27)

like image 183
Zimeng Zhao Avatar answered Nov 14 '22 23:11

Zimeng Zhao