samedi 31 mars 2018

How to build code that contains constant expression with c++11

Hello I am testing new c++ library : TagParser from Martchus https://github.com/Martchus/tagparser I am getting that error when I compile the following code:

CODE:

#include <tagparser/mediafileinfo.h>
#include <tagparser/diagnostics.h>

using namespace TagParser;

// create a MediaFileInfo for high-level access to overall functionality of the library
MediaFileInfo fileInfo;
// create container for errors, warnings, etc.
Diagnostics diag;

...

ERROR:

In file included from /usr/include/c++/5/cstdint:35:0,
                 from /usr/local/include/c++utilities/conversion/types.h:4,
                 from /usr/local/include/tagparser/tagtarget.h:6,
                 from /usr/local/include/tagparser/settings.h:4,
                 from /usr/local/include/tagparser/abstractcontainer.h:5,
                 from /usr/local/include/tagparser/mediafileinfo.h:4,
                 from TagParserTest.cpp:1:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error:
#error This file requires compiler and library support for the ISO C++ 2011 standard.
This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

When I try to build with the -std=c++11 option I get this error:

In file included from /usr/local/include/tagparser/abstractcontainer.h:5:0,
                 from /usr/local/include/tagparser/mediafileinfo.h:4,
                 from TagParserTest.cpp:1:
/usr/local/include/tagparser/settings.h: In function ‘constexpr TagParser::TagCreationFlags& TagParser::operator|=(TagParser::TagCreationFlags&, TagParser::TagCreationFlags)’:
/usr/local/include/tagparser/settings.h:53:1: error: expression ‘(lhs = ((TagParser::TagCreationFlags)(((std::underlying_type<TagParser::TagCreationFlags>::type)lhs) | ((std::underlying_type<TagParser::TagCreationFlags>::type)rhs))))’ is not a constant-expression
 }

I really don't know how to solve this. Can anyone help me?

Aucun commentaire:

Enregistrer un commentaire