首页 > 解决方案 > vs2019 wxwidgets 示例 hello world -> “未找到 wxstrcoll”

问题描述

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

遵循确切的说明,下载预编译的库,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 ==========

标签: wxwidgets

解决方案


defined(__VISUALC__) ||不幸的是,您需要手动修改标头以在3.0.5 中使用 MSVS 2019 修复构建,并wxNEEDS_DECL_BEFORE_TEMPLATEwx/wxcrt.h.

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


推荐阅读