国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C++ > 正文

Mingw64編譯wxWidgets 3.0.2常見錯(cuò)誤分析

2020-05-23 13:58:51
字體:
供稿:網(wǎng)友

使用Mingw64編譯wxWidgets3.0.2,首先得下載wxMSW-Setup-3.0.2.exe(https://sourceforge.net/projects/wxwindows/files/3.0.2/wxMSW-Setup-3.0.2.exe,然后按照如下步驟編譯(假設(shè)要編譯一個(gè)Unicode共享庫版的wxWidgets):

cd X:/wxWidgets-3.0.2/build/msw

    make -f makefile.gcc SHARED=1 UNICODE=1

  然而編譯到一半,從C代碼變?yōu)镃++代碼時(shí),就會(huì)產(chǎn)生如下錯(cuò)誤(有許多類似錯(cuò)誤,只選取一處):

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

  這次編譯完了所有中間件,但是到鏈接時(shí)候又出了問題:

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

  這實(shí)在是令我百思不得其解了,翻遍了docs文件夾的每個(gè)角落,終于在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"進(jìn)行編譯,這會(huì)導(dǎo)致一些wxWidgets依賴的extensions(擴(kuò)展名?)被屏蔽的問題。然后用以下命令重新編譯,就成功了。

    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

后記

  上面說到關(guān)于extensions,這里的意思應(yīng)該是擴(kuò)展,即gnu的g++(gcc)提供給c/c++代碼除c++標(biāo)準(zhǔn)以外的支持。如果這些支持沒有被啟用,自然會(huì)導(dǎo)致上面像wxWidgets的庫編譯失敗,不過這么依賴語言外的額外實(shí)現(xiàn)也不見得是件好事吧。

 

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 耿马| 和田县| 格尔木市| 军事| 囊谦县| 甘肃省| 平武县| 海伦市| 方山县| 沁源县| 化德县| 拜城县| 大厂| 新乡市| 乡宁县| 应城市| 黄龙县| 苍山县| 美姑县| 格尔木市| 防城港市| 平南县| 和静县| 东兰县| 正蓝旗| 台江县| 南陵县| 临邑县| 从江县| 隆德县| 五常市| 揭东县| 郸城县| 松桃| 阿拉善盟| 杭锦后旗| 凤冈县| 新龙县| 宝应县| 东源县| 海淀区|