我正在尝试cabal install
wxHaskell 的一个组件(针对 wxWidgets 3.0 的 Haskell 平台 2013.2)。我能够使用来自 mingw.org 的 32 位 mingw 编译 git 版本。但最终,安装的 wx 无法正常运行,并且运行一个最小示例会在 wxc.dll 中出现运行时异常。所以我尝试在 TDM-GCC 4.8.1 64 位下编译相同的东西,因为 wxWidgets 人以 TDM-GCC 编译的二进制文件的形式提供他们的二进制文件。
但是我立即遇到了 TDM-GCC 的编译错误,告诉我
错误:未在此范围内声明“strnlen”
令我惊讶的是,即使 mingw32 和 TDM-gcc 都使用来自 Haskell Platform 的相同外部 gcc c:\HaskellPlatform\2013.2.0.0\mingw\bin\gcc.exe
,一个会出错,而另一个编译得很好。
导致问题的第一个文件是src\cpp\eljaccelerator.cpp
. 在mingw32下编译OK:
...
c:\HaskellPlatform\2013.2.0.0\mingw\bin\gcc.exe -Wl,--hash-size=31 -Wl,--reduce-
memory-overheads -Isrc/include -IC:/MinGW/msys/1.0/local/include/wx-3.0 -IC:/Min
GW/msys/1.0/local/lib/wx/include/msw-unicode-3.0 -D__WXMSW__ -DWXUSINGDLL -D_LAR
GEFILE_SOURCE=unknown -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\eljaccelerato
r.cpp -o dist\build\src/cpp/eljaccelerator.o
但在 TDM-gcc 下给出错误:
Building wxc
c:\HaskellPlatform\2013.2.0.0\mingw\bin\gcc.exe -Wl,--hash-size=31 -Wl,--reduce-
memory-overheads -Isrc/include -IC:/mingw/msys/1.0/local/include/wx-3.0 -IC:/min
gw/msys/1.0/local/lib/wx/include/msw-unicode-3.0 -D__WXMSW__ -DWXUSINGDLL -D_FIL
E_OFFSET_BITS=64 -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\eljaccelerator.cpp
-o dist\build\src/cpp/eljaccelerator.o
In file included from C:/mingw/msys/1.0/local/include/wx-3.0/wx/crt.h:19:0,
from C:/mingw/msys/1.0/local/include/wx-3.0/wx/string.h:4305,
from C:/mingw/msys/1.0/local/include/wx-3.0/wx/memory.h:15,
from C:/mingw/msys/1.0/local/include/wx-3.0/wx/object.h:19,
from C:/mingw/msys/1.0/local/include/wx-3.0/wx/wx.h:15,
from src/include/wrapper.h:20,
from src\cpp\eljaccelerator.cpp:1:
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h: In function 'size_t wxStrnlen
(const char*, size_t)':
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h:173:92: error: 'strnlen' was n
ot declared in this scope
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h: In function 'size_t wxStrnlen
(const wchar_t*, size_t)':
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h:187:95: error: 'wcsnlen' was n
ot declared in this scope
Failed to install wxc-0.90.1.1
我想知道是否有人有类似的经历。知道出了什么问题以及如何修复 TDM-GCC 的编译吗?我尝试添加#include <cstring>
,wxcrt.h
但它没有改变任何东西。
仅供参考,我已经分别从 mingw 和 tdm-gcc 版本的源代码编译了 wxWidgets 3.0.0,使用
./configure --enable-stl && make && make install
如果需要,我可以提供更多详细信息。