Suppress g ++ "-Wliteral-suffix" warning for specific included headers

I am working on a project in which I use the new C ++ 11 standard. Because of this, the few included headers from the library now generate a warning -Wliteral-suffix , which I would suppress for this.

I found an easy solution for this using pragmas, but for me it does not work

How to suppress GCC warnings from library headers?

This is my current code:

 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wliteral-suffix" #include <pylon/PylonBase.h> #include <pylon/InstantCamera.h> #include <pylon/TlFactory.h> #pragma GCC diagnostic pop 

All current warnings generated by the library are as follows:

 /opt/pylon3/genicam/library/CPP/include/Base/GCException.h:272:105: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix] 

I am using gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

+6
source share
2 answers

I think you should use the -Wno-literal-suffix opposite: -Wno-literal-suffix . I also get more problems with this version than with the old 4.7.2 (better).

+7
source

If you get warnings from system headers, you should include them as such:

 # Makefile CPPFLAGS += -isystem/path/to/python/prefix 

Literature:

0
source

Source: https://habr.com/ru/post/971484/


All Articles