我正在尝试为 wxWidgets 3.0 构建 wxHaskell。我使用了来自https://github.com/wxHaskell/wxHaskell的最新 git 版本的 wxHaskell 。
我尝试install.txt
在 wxHaskell-master.zip 中进行操作,到目前为止我所做的是:
cd wxdirect
cabal install
cd ../wxc
cabal install
wxc
不会编译,因为它的 Setup.hs 需要 wxWidgets 2.9。我换了
let wxRequiredVersion = "2.9"
和
let wxRequiredVersion = "3.0"
然后做了:
cabal install --extra-lib-dirs=/usr/local/lib
所有编译都正常,但最后我得到了一些链接错误。最难解决的问题如下:
dist\build\src\cpp\eljlog.o:eljlog.cpp:(.rdata$_ZTV6ELJLog[vtable for ELJLog]+0x20): undefined reference to `wxLog::DoLog(unsigned long, char const*, long)'
对应的源代码在wxc/src/cpp/eljlog.cpp
:
class ELJLog : public wxLog
{
private:
TLogFunc func;
void* EiffelObject;
protected:
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t)
{
wxString s(szString);
func (EiffelObject, (int)level, (void*)&s , (int)t);
}
....
我不知道是什么导致了这个错误以及如何解决它。我对这个vtable
问题做了一些搜索,有人认为这是由于在子类中声明了一个虚函数而没有定义它。其他人建议这是在 g++ 命令行上给出目标文件的顺序。但这里似乎都不是这样。我尝试删除 functionELJLog::DoLog
函数或注释掉 virtual 关键字。奇怪的是,总是有一个链接错误/错误说明 ELJLog 的 vtable,并且指的是 wxLog::DoLog,即使没有出现 DoLog。
此外,作为旁注,wxLog::DoLog
wxWidgets 3.0 文档中似乎缺少。我不确定此功能是否已弃用。但是,它仍然以我无法理解的方式导致遗留派生类的错误。
有什么想法吗?
--- 编辑2 ---
如果我注释掉有问题的功能
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) ...
我得到了不同的链接错误,如下所示:
dist\build\src\cpp\eljlog.o:eljlog.cpp:(.rdata$_ZTV6ELJLog[vtable for ELJLog]+0x
20): undefined reference to `wxLog::DoLog(unsigned long, char const*, long)'
dist\build\src\cpp\eljlog.o:eljlog.cpp:(.rdata$_ZTV6ELJLog[vtable for ELJLog]+0x
24): undefined reference to `wxLog::DoLog(unsigned long, wchar_t const*, long)'
collect2: ld returned 1 exit status
- - 编辑 - -
我在 mingw.org 的 mingw32 下工作。我从源代码构建了 wxWidgets 3.0.0 稳定版本,我做的 stpes 如下:
per http://mingw.5.n7.nabble.com/win32api-version-4-td32288.html :
edit line 2217 of /c/mingw/{,mingw32/}include/commctrl.h to read
#define TV_DISPINFO NMTVDISPINFO
instead of
#define TV_DISPINFO __AW(NMTVDISPINFO)
The above was needed to fix a MinGW32 4.8.1-4 issue. Then,
./configure --enable-stl --disable-shared
make
make install
./configure --enable-stl
make
make install
mv /usr/local/lib/wx*.dll /c/mingw/bin/