vs2019 wxwidgets 示例 hello world -> “wxstrcoll 未找到”

问题描述 投票:0回答:2

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

按照确切的说明进行操作,下载预编译的库,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
2个回答
2
投票

不幸的是,您需要手动修改标头以修复 3.0.5 中 MSVS 2019 的构建,并删除

defined(__VISUALC__) ||
wxNEEDS_DECL_BEFORE_TEMPLATE
定义之前的
wx/wxcrt.h
部分检查。

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


0
投票

我只是将定义 wxNEEDS_DECL_BEFORE_TEMPLATE 添加到项目的预处理器定义中来解决这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.