【问题标题】:Trouble building wxwidget构建 wxwidget 时遇到问题
【发布时间】:2021-08-02 09:39:50
【问题描述】:

我一直在尝试使用 CMake 在 Windows 10 上构建 wxwidget 3.1.5。

我只是使用了官网推荐的命令:

cmake -G "MinGW Makefiles" ..\wxWidgets-3.1.5\ -DwxBUILD_TESTS=ALL
cmake --build .

进展顺利,直到弹出消息

[100%] Building CXX object tests/headers/CMakeFiles/test_headers.dir/__/__/__/__/tests/allheaders.cpp.obj
In file included from D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/platform.h:343,
                 from D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/defs.h:45,
                 from D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/wxprec.h:12,
                 from D:\tools\wxwidget\wxWidgets-3.1.5\tests\testprec.h:4,
                 from D:\tools\wxwidget\wxWidgets-3.1.5\tests\allheaders.cpp:433:
D:/tools/wxwidget/wxWidgets-3.1.5/include/wx/wxcrtbase.h:228:39: error: redundant redeclaration of 'size_t wcsnlen(const wchar_t*, size_t)' in same scope [-Werror=redundant-decls]
  228 |     wxDECL_FOR_MINGW32_ALWAYS(size_t, wcsnlen, (const wchar_t*, size_t))

有人知道如何应对吗?提前致谢!

【问题讨论】:

  • 似乎是 wxWidgets 的问题。你搜索过他们的错误跟踪器吗?看起来你没有做错什么。 trac.wxwidgets.org
  • 您使用的是哪个编译器 (g++ --version)?
  • 9.2.0 @Brecht Sanders

标签: cmake mingw wxwidgets


【解决方案1】:

WxWidgets 已经为你提供了 makefile。您需要做的就是使用它?:

cd WxWidgets-3.1.5\build\msw
mingw32-bin.exe -f makefile.gcc BUILD=debug

【讨论】:

  • 谢谢。在我发现 CMake 不起作用后,我改用 Makefile,但我确实希望我可以使用 CMake ...
  • @Hans,为什么? Yuu 构建了一次库并在分发应用程序之前忘记它?或者您有更大的应用程序已经在使用 CMake,并且您想集成您的部分并让用户构建它?无论如何-您是否进行开发和测试,集成部分可以稍后完成。