无法在Cygwin上构建wxwidgets:'operator []'基于get_apebase.o错误的模糊重载

时间:2014-05-12 03:46:00

标签: cygwin wxwidgets

我愿意打赌我没有正确配置,但我对wxWidgets_3_0

的需求并不简单。

我收到以下错误:

$ make

/home/Bill/WX_3_0_BRANCH/build-debug/bk-deps g++ -c -o basedll_appbase.o  -D__WXM    SW__      -DWXBUILDING -I/home/Tom/WX_3_0_BRANCH/build-debug/src/tiff/libtiff -I    ../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/zlib -I../src/regex -I..    /src/expat/lib -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1  -Wall -Wundef -W    unused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS    =64 -I/home/Tom/WX_3_0_BRANCH/build-debug/lib/wx/include/msw-unicode-3.0 -I../in    clude -O2 -fno-strict-aliasing  ../src/common/appbase.cpp
In file included from ../src/common/appbase.cpp:42:0:
../include/wx/filename.h: In static member function ‘static wxUniChar wxFileName    ::GetPathSeparator(wxPathFormat)’:
../include/wx/filename.h:473:43: error: ambiguous overload for ‘operator[]’ (ope    rand types are ‘wxString’ and ‘unsigned int’)
         { return GetPathSeparators(format)[0u]; }

In file included from ../include/wx/memory.h:15:0,
                 from ../include/wx/object.h:19,
                 from ../include/wx/list.h:32,
                 from ../src/common/appbase.cpp:30:
../include/wx/string.h:1544:15: note: wxUniChar wxString::operator[](int) const
     wxUniChar operator[](int n) const
               ^
../include/wx/string.h:1546:15: note: wxUniChar wxString::operator[](long int) c                             onst
     wxUniChar operator[](long n) const
               ^
../include/wx/string.h:1548:15: note: wxUniChar wxString::operator[](size_t) con                             st
     wxUniChar operator[](size_t n) const
               ^
../include/wx/string.h:1556:18: note: wxUniCharRef wxString::operator[](int)
     wxUniCharRef operator[](int n)
                  ^
../include/wx/string.h:1558:18: note: wxUniCharRef wxString::operator[](long int                             )
     wxUniCharRef operator[](long n)
                  ^
../include/wx/string.h:1560:18: note: wxUniCharRef wxString::operator[](size_t)
     wxUniCharRef operator[](size_t n)
                  ^

Makefile:28650: recipe for target 'basedll_appbase.o' failed
make: *** [basedll_appbase.o] Error 1

这就是该行的makefile中的内容:

basedll_appbase.o: $(srcdir)/src/common/appbase.cpp $(BASEDLL_ODEP)
        $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/appbase.cpp

2 个答案:

答案 0 :(得分:2)

这是known bug,但我认为它只影响了wxGTK,因此它的优先级较低(因为在Cygwin下使用wxGTK的人群很小)。如果它也影响wxMSW,那么修复它会很好,特别是因为它应该不难,我们将尝试在下一个3.0.1版本中进行修复。

答案 1 :(得分:1)

似乎long,unsigned int和size_t都应该作为不同的函数签名存在 因此,针对此情况的修复是将size_t 的强制转换添加到0u或1u的任何模糊过载错误。

以下是示例:在filename.h中我编辑了源代码:

  // get the canonical path separator for this format
    static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE)
        { return GetPathSeparators(format)[0u]; } 

  // get the canonical path separator for this format
    static wxUniChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE)
        { return GetPathSeparators(format)[(size_t)0u]; } 

我要做的第二件事是配置我的64位窗口

../configure --host=i686-w64-mingw32 --build=i686-pc-cygwin