vs2019 wxwidgets 示例 hello world -> "wxstrcoll not found"

vs2019 wxwidgets sample hello world -> "wxstrcoll not found"

好像很多人都遇到了这个问题,我似乎找不到解决方案。

按照确切的说明进行操作,下载预编译库,v 3.0.5 - 最新的稳定版本

set wxwin env var
make new 32bit empty project
copy the hello world app into new source file
set additional include
set preproc defintions -> UNICODE & _UNICODE on
set linker libs

构建 ->

1>------ Build started: Project: wxtest, Configuration: Debug Win32 ------
1>Source.cpp
1>c:\work\wxwin\include\wx\wxcrt.h(487): error C3861: 'wxStrcoll': identifier not found
1>c:\work\wxwin\include\wx\wxcrt.h(487): message : 'wxStrcoll': function was not declared in the template definition context and can be found only via argument-dependent lookup in the instantiation context
1>c:\work\wxwin\include\wx\wxcrt.h(496): message : see reference to function template instantiation 'int wxStrcoll_String<const wchar_t*>(const wxString &,const T &)' being compiled
1>        with
1>        [
1>            T=const wchar_t *
1>        ]
1>Done building project "wxtest.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

不幸的是,您需要手动修改 header 以修复 3.0.5 中使用 MSVS 2019 的构建,并删除 wxNEEDS_DECL_BEFORE_TEMPLATEwx/wxcrt.h 定义之前的 defined(__VISUALC__) || 部分检查=].

FWIW 此问题已在 wx 3.1 中修复了很长时间(~6 年),您可以使用 MSVS 2019 开箱即用地编译 3.1.3 或即将发布的 3.1.4。