0

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?

  • 1
    There are many possible reasons. 1) The compiler is too old, it may provide only incomplete c++11 support, 2) The code is wrong, and your current version of your C++ compiler detects the error. It's quite common for updated compilers to be able to detect more technical violations of the C++ spec that the older compilers didn't pick up, and that code hasn't been fixed; 3) You're missing some prerequisite software that needs to be installed. Unfortunately there's only one person on stackoverflow.com who can figure it out - you. Only you have full access to this code, and can examine it. – Sam Varshavchik Apr 01 '18 at 01:38
  • That expression looks like it might need C++14, not just 11. Have you tried that? – Daniel H Apr 01 '18 at 01:38
  • It could be a bug in the library - you could try using a previous stable version of tagparser. Based on a cursory glance, [at least once recent commit](https://github.com/Martchus/tagparser/commit/281d3e79523c9c54f5faad1b0ec6ff57f0b49748) looks a little bit suspect to me - there could still be lingering problems depending on what version of GCC you are using. – jcarpenter2 Apr 01 '18 at 01:40
  • 1
    what compiler version are you using? – Lubo Antonov Apr 01 '18 at 01:56

1 Answers1

0

Many thanks to Daniel H. When I use c++14 instead of c++11 it just works fine.

Thanks.