无法在 wxwidgets windows 10 中编译调试

failed to compile debug in wxwidgets windows 10

我想跨多个平台开发应用程序。我是 wxwidgets 的新手。我想编译调试,但它会产生错误。这是我的命令结果。请帮我。到目前为止,我已经使用 wpf mvvm c# 完成了应用程序,但它只能在 windows 环境中 运行。所以我知道它可以在任何环境中编译,所以我改用 C++。请帮助我。

C:\wxWidgets-3.0.2\build\msw>mingw32-make SHELL=CMD.exe -f makefile.gcc USE_XRC=1 BUILD=debug UNICODE=1 SHARED=1 MONOLITHIC=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport"
if not exist ..\..\lib\gcc_dll\mswud mkdir ..\..\lib\gcc_dll\mswud
g++ -c -o gcc_mswuddll\monodll_any.o -g -O0 -mthreads  -DHAVE_W32API_H -D__WXMSW__       -D_UNICODE  -I..\..\lib\gcc_dll\mswud -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\lib -I..\..\src\stc\scintilla\include -I..\..\src\stc\scintilla\lexlib -I..\..\src\stc\scintilla\src -D__WX__ -DSCI_LEXER -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL   -Wno-ctor-dtor-privacy  -fno-keep-inline-dllexport -MTgcc_mswuddll\monodll_any.o -MFgcc_mswuddll\monodll_any.o.d -MD -MP ../../src/common/any.cpp
In file included from C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/type_traits:35:0,
                 from ..\..\include/wx/strvararg.h:25,
                 from ..\..\include/wx/string.h:46,
                 from ..\..\include/wx/any.h:19,
                 from ../../src/common/any.cpp:18:
C:/TDM-GCC-32/lib/gcc/mingw32/5.1.0/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from ..\..\include/wx/string.h:46:0,
                 from ..\..\include/wx/any.h:19,
                 from ../../src/common/any.cpp:18:
..\..\include/wx/strvararg.h:350:18: error: 'is_enum' in namespace 'std' does not name a template type
     typedef std::is_enum<T> is_enum;
                  ^
..\..\include/wx/strvararg.h:354:54: error: 'is_enum' was not declared in this scope
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                      ^
..\..\include/wx/strvararg.h:354:68: error: template argument 1 is invalid
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                                    ^
makefile.gcc:6428: recipe for target 'gcc_mswuddll\monodll_any.o' failed
mingw32-make: *** [gcc_mswuddll\monodll_any.o] Error 1

C:\wxWidgets-3.0.2\build\msw>

您需要将 C++ 标准设置为 11。将 -std=c++11 添加到您的编译命令行(我没有粘贴整行,因为它很长。):

mingw32-make SHELL=CMD.exe -f makefile.gcc -std=c++11 USE_XRC=1 BUILD=debug U...

您是否一直遵循通常的构建说明而不做任何更改?发生了一些非常奇怪的事情,因为 HAVE_TYPE_TRAITS 是以某种方式为您定义的(查看文件 wx/strvararg.h 中的条件,就在错误指向您的行上方),但事实并非如此使用未修改的 wxWidgets 源,因为它仅在使用 C++11 时定义,即当 __cplusplus >= 201103L 时,但您使用的编译器 (g++ 5.1) 默认将 __cplusplus 定义为 199711L

如果您尝试以不同的方式构建它,例如使用配置,您必须在再次构建之前清理所有内容,即如果您下载了它,只需销毁整个源目录并重新扩展存档,或者如果您已克隆 Git 存储库,则执行 git clean -fdx