Error “is_enum not declared in this scope” when tr

2019-09-26 02:02发布

问题:

The G++ compiler shows the following errors when I try to compile:

C:\wx\include\wx\strvararg.h|350|error: 'is_enum' in namespace 'std' does not name a template type|
C:\wx\include\wx\strvararg.h|354|error: 'is_enum' was not declared in this scope|
C:\wx\include\wx\strvararg.h|354|error: template argument 1 is invalid|

I am using Code::Blocks for this, with a non-monolithic DLL build of wxWidgets.

Thanks for any help!

回答1:

As Brian already indicated, you should enable C++11. There are two ways of doing this as you can see What are the differences between -std=c++11 and -std=gnu++11?.

As I remember, when compiling the whole wxWidgets library, I used -std=gnu++11 and had no problems.



回答2:

Just to add to macroland comment:

You should consider upgrading to gcc version 5.2+. This version(s) does have a full set of c++11 features, whereas previous versions have them partially.