Mingw64 compiler wxwidgets 3.0.2 common error Analysis _c language

Source: Internet
Author: User
Tags wxwidgets

To compile wxWidgets3.0.2 using MINGW64, you first have to download Wxmsw-setup-3.0.2.exe (https://sourceforge.net/projects/wxwindows/files/3.0.2/ Wxmsw-setup-3.0.2.exe, and then compile with the following steps (assuming you want to compile a Unicode shared library version of wxwidgets):

CD X:\WXWIDGETS-3.0.2\BUILD\MSW

Make-f MAKEFILE.GCC shared=1 unicode=1

However, when compiled into half, from C code to C + + code, it will produce the following error (there are many similar errors, select only one):

In the 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 + + standard. This support is currently experimental, and must being enabled with THE-STD=C++11 or-std=gnu++11 options.

Since only c++11 support not open the problem, just change the cxxflags can, so, as follows command recompile.

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

All middleware was compiled this time, but there was a problem when it came to the link:

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) ':
......

This is really makes me baffled, rummaged every corner of the Docs folder, finally found the answer in Install.txt, there is such a sentence:

C++11 note:if you want to compile wxWidgets into c++11 mode, you currently have
To use-std=gnu++11 switch as-std=c++11 disables some extensions
That's wxWidgets relies on. i.e. please use cxxflags= "-std=gnu++11".

It's clear that you can't compile with "std=c++11," which can lead to some wxwidgets-dependent extensions (extension?). ) The problem of being shielded. Then recompile with the following command, and it succeeds.

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

Postscript

As it says about extensions, the idea here is to expand, that GNU g++ (GCC) provides support for C + + code in addition to C + + standards. If these support is not enabled, it will naturally lead to a library compiler like Wxwidgets failed, but it is not necessarily a good idea to rely on additional implementations outside of the language.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.