Mingw64编译wxWidgets 3.0.2常见错误分析
2017-04-05 21:36
363 查看
cd X:\wxWidgets-3.0.2\build\msw
make -f makefile.gcc SHARED=1 UNICODE=1
然而编译到一半,从C代码变为C++代码时,就会产生如下错误(有许多类似错误,只选取一处):
In file included from e:\mingwd\mingw\include\c++\5.2.0\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:
e:\mingwd\mingw\include\c++\5.2.0\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.
既然只是c++11支持没有打开的问题,只要改一下CXXFLAGS即可,于是乎,按如下命令重新编译。
make -f makefile.gcc CXXFLAGS="-std=c++11" SHARED=1 UNICODE=1 clean
make -f makefile.gcc CXXFLAGS="-std=c++11" SHARED=1 UNICODE=1
这次编译完了所有中间件,但是到链接时候又出了问题:
E:\wxWidgets-3.0.2\lib\gcc_lib64/libwxmsw30ud.a(monolib_filename.o): In function `wxChmod(wxString const&, unsigned short)':
E:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:513: undefined reference to `wxMSLU__wchmod(wchar_t const*, int)'
E:\wxWidgets-3.0.2\lib\gcc_lib64/libwxmsw30ud.a(monolib_filename.o): In function `wxOpen(wxString const&, int, unsigned short)':
E:\wxWidgets-3.0.2\build\msw/../../include/wx/filefn.h:515: undefined reference to `wxMSLU__wopen(wchar_t const*, int, int)'
E:\wxWidgets-3.0.2\lib\gcc_lib64/libwxmsw30ud.a(monolib_file.o): In function `wxRemove(wxString const&)':
E:\wxWidgets-3.0.2\build\msw/../../include/wx/wxcrt.h:758: undefined reference to `wxMSLU__wremove(wchar_t const*)'
E:\wxWidgets-3.0.2\lib\gcc_lib64/libwxmsw30ud.a(monolib_file.o): In function `wxAccess(wxString const&, unsigned short)':
......
这实在是令我百思不得其解了,翻遍了docs文件夹的每个角落,终于在install.txt中找到了答案,里面有这么一句话:
C++11 note: If you want to compile wxWidgets in C++11 mode, you currently have
to use -std=gnu++11 switch as -std=c++11 disables some extensions
that wxWidgets relies on. I.e. please use CXXFLAGS="-std=gnu++11".
说的很清楚,不能用”std=c++11"进行编译,这会导致一些wxWidgets依赖的extensions(扩展名?)被屏蔽的问题。然后用以下命令重新编译,就成功了。
make -f makefile.gcc CXXFLAGS="-std=gnu++11" SHARED=1 UNICODE=1 clean
make -f makefile.gcc CXXFLAGS="-std=gnu++11" SHARED=1 UNICODE=1
后记
上面说到关于extensions,这里的意思应该是扩展,即gnu的g++(gcc)提供给c/c++代码除c++标准以外的支持。如果这些支持没有被启用,自然会导致上面像wxWidgets的库编译失败,不过这么依赖语言外的额外实现也不见得是件好事吧。相关文章推荐
- Mingw64编译wxWidgets3.0.2常见错误
- 前端开发环境之GRUNT自动WATCH压缩JS文件与编译SASS文件环境下Ruby安装sass常见错误分析
- MySQL编译安装时常见错误分析
- GDAL在VS2015上编译及常见错误分析
- Linux内核编译常见错误分析
- Mingw64编译wxWidgets 3.0.2常见错误分析
- Nginx编译安装时常见错误分析
- mysql编译安装及其各参数详解、常见错误分析
- C++常见编译错误分析总结
- SQL Server连接中三个常见的错误分析
- VC中常见的一些编译链接错误的解决(1)
- Strus常见错误及原因分析(ZZ)
- Oracle常见错误代码的分析与解决
- SQL Server连接中常见的错误分析
- 一个常见数据库操作错误的分析(二)
- Struts常见错误及原因分析
- 一个常见数据库操作错误的分析(五)
- 一个常见数据库操作错误的分析(四)
- SQL Server连接中三个常见的错误分析
- C++ 常见编译连接错误的解决!