I am trying to write some parsers with boost.spirit.qi but when i am compiling i am getting the following deprecated warnings:
In file included from /usr/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0 ...
#pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
#pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
Am i using the wrong parsers or something old? How can I get rid of these warnings?
EDIT: The /usr/include/boost/iostreams/detail/is_dereferenceable.hpp is somehow included by /usr/include/boost/spirit/include/qi.hpp
I am using Boost Version 1.61
I had a similar issue using the boost geometry package and could not upgrade boost to fix the error.
Disable boost deprecated warnings with the below define:
#define BOOST_ALLOW_DEPRECATED_HEADERS
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
Note the second define handles a common warning that occurs alongside of the deprecated warning and may not be needed.
Related
Compiling one of my projects that uses gRPC with the latest Visual Studio 2019 16.5 preview 2 compiler gives rise to this warning:
1>D:\...\grpcpp\impl\codegen\security\auth_context.h(38,19): warning C4996: 'std::iterator<std::input_iterator_tag,const grpc::AuthProperty,ptrdiff_t,const grpc::AuthProperty *,const grpc::AuthProperty &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
Before submitting a bug report, I thought I've check here if the gRPC developers are already aware of this?
gRPC is currently dependant on Absel that is reliant on C++11. You should avoid using two different C++ standards in your applications to avoid template incompatibilities. There is a longer discussion on Absel C++11 vs C++17 versions here: https://github.com/abseil/abseil-cpp/issues/259.
You can check out the Absel pages for more details at https://github.com/abseil/abseil-cpp.
The position that gRPC doesn't support C++17 is a little surprising. I might be missing it, but I don't see any mention on the main grpc page that anything beyond C++11 isn't supported. The only support matrix I was able to find was: https://grpc.io/docs/#official-support
In general both protobuf and gRPC usage will cause a slew of warnings in Visual Studio, unrelated to this error. For generated cc files, suppressing warnings 4267, 4996, and 4244 is helpful.
For this C++17 warning/error, since the issue is in a header, you'll hit the issue on your own, non-generated cpp files. You don't want to disable such warnings/errors on every file that uses the header, because then you'll mask your own issues. I currently work around by creating grpcpp.suppress_errors.h:
#pragma once
#pragma warning ( push )
#pragma warning( disable : 4996)
#include <grpcpp/grpcpp.h>
#pragma warning ( pop )
Then instead of including <grpcpp/grpcpp.h>, include grpcc.suppress_errors.h . It's a bit silly, but it will keep your own code clean from suppressions.
aggieNick02's answer didn't fix it for me. But I could could manage to suppress the errors in Visual Studio like so:
I added _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS; to the preprocessor definitions.
Not as optimal as aggieNick02's answer, but at least this kept me going.
I got grpc from vcpkg, if that info helps somebody:
1.37.0 3
dc35791a568aacf855355bcfcdff978ec22e69d3
2021-07-27
abseil (2021-03-24), c-ares (1.17.1), grpc (1.37.0), openssl (1.1.1k), protobuf (3.15.8), protobuf (3.15.8), re2 (2020-10-01), upb
(2020-12-19), zlib (1.2.11)
gRPC does not currently support C++17. We're currently using C++11. You should probably use whatever flags are necessary to have your compiler enforce C++11 semantics.
Version 1.71.0 of boost/progress.hpp warns me:
include/boost/timer.hpp:21:98: note: #pragma message: This header is deprecated.
Use the facilities in <boost/timer/timer.hpp> instead.
BOOST_HEADER_DEPRECATED( "the facilities in <boost/timer/timer.hpp>" )
But when I look in boost/timer.hpp there's no obvious path to upgrade, since there is no boost::progress_display class.
In what way do the Boost folks intend for me to circumnavigate the deprecation of progress.hpp, other than rewriting it?
There's not a good solution today.
Your choices are:
use an older boost that doesn't have the deprecation warning
ignore the warning
write a replacement
wait for boost 1.72 and use: #include <boost/timer/progress_display.hpp>
I ran into the same issue and found this summary:
https://github.com/boostorg/timer/issues/12
I'm upgrading the libraries to MSVC 141 and moving to Visual Studio 2017.
I've downloaded the newest Boost libraries (boost_1_64_0_b2-msvc-14.1-64.exe). When building the code, I get this error:
...\boost\move\detail\type_traits.hpp(757): error C2187: syntax error:
')' was unexpected here ...\boost\move\detail\type_traits.hpp(763):
note: see reference to class template instantiation
'boost::move_detail::is_copy_constructible' being compiled
In the mentioned header, BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE is defined but the latest MSVC doesn't understand the enclosed code.
Undefining this macro helps, but it there a better solution to fix this? What's the reason here?
As suggested here, undefine macro U after each inclusion of cpprest headers or before inclusion of boost headers.
Example:
#include <cpprest/http_client.h>
#undef U
need include -
#define _TURN_OFF_PLATFORM_STRING
"#include <cpprest/details/basic_types.h>"
....
see:
https://github.com/Microsoft/vcpkg/issues/836
I am working in a project dependent of Boost (http://kratos-wiki.cimne.upc.edu/index.php/Main_Page), this project currently only supports C++03. With the last update of gcc++ (v.5) the C++11 has become the default std, technically I solved the problem modifying the CXX_FLAGS adding:
-std=c++03
The problem comes with the Boost library, which I am not able to compile with the C++03 std (I think, I don't know how to check with which std I have compiled). I tried employing the following command to compile Boost:
./b2 install stage --with-python --with-serialization cxxflags="-std=c++03"
I have tried too modify the Jamroot file, adding the following lines:
<toolset>gcc:<cxxflags>-std=gnu++03
<toolset>clang:<cxxflags>-std=c++03
But the problem persist, when I compile the whole project I obtain the following kind of warning (several times):
/usr/local/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
# pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
That's why I suspect that my changes do not take effect.
Thank you very much for your help
I think you can safely ignore those warnings for now. I am compiling boost 1_60_0 with gcc 5.2.1 and std=c++11, and I get the same warnings. There is a ticket on it, but meanwhile it hasn't caused me any problems at this time. I commented out the two [#pragma warning] lines in the boost code, so I don't get a lot of distracting output in my build:
boost/type_traits/detail/template_arity_spec.hpp line 13:
// noisy: # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
boost/type_traits/detail/bool_trait_def.hpp line 18:
// noisy: # pragma message ("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
UPDATE The problem still exists in boost 1.61.0. I used the same exact fix again.
I'm trying to compile some downloaded source which contains lots of:
142 #ifdef __cplusplus
143 #pragma pack(1)
144 #endif
but I get the following error and it won't compile:
src/globals.h:143:16: error: expected declaration before end of line
mingw32-make: *** [obj/main.o] Error 1
I'm using a makefile downloaded with the rest of the source to compile it.
what do I need to do to get this to compile?
EDIT:
The source code is the code for KeeperFX available from google code.
As I know #pragma directives belongs to the Microsoft C++ Compiler. GCC supports some of these directives, but MinGW does not.
You could use GCC __attribute__((packed)) extension.
While I have absolutely no idea why GCC picked on pragma pack to highlight it's issue the actual problem was that it was trying to compile a Version.h resource (Version resource information) as code. The compile was failing and just decided to spit out a completely irrelevant error.