我一直在尝试从旧的 2.8.12 升级到 wxWidgets 2.9.4,但遇到了问题。我从命令行编译它没有错误,但是当我尝试在以前版本下运行良好的程序中使用它们时,我得到未解决的外部问题。我将它缩减为一个裸框架和 TextCtrl 对象,它仍然这样做(它与目前的示例代码之一基本相同)。
我尝试了以下命令来构建静态库:
- nmake -f makefile.vc SHARED=0 BUILD=release + nmake -f makefile.vc SHARED=0 BUILD=debug
- nmake -f makefile.vc SHARED=0 MONOLITHIC=0 BUILD=release + nmake -f makefile.vc SHARED=0 MONOLITHIC=0 BUILD=debug
- nmake -f makefile.vc SHARED=0 BUILD=release UNICODE=0 + nmake -f makefile.vc SHARED=0 BUILD=debug UNICODE=0
- nmake -f makefile.vc SHARED=0 BUILD=release UNICODE=0 MONOLITHIC=0 + nmake -f makefile.vc SHARED=0 BUILD=debug UNICODE=0 MONOLITHIC=0
请注意,我尝试将它们与推荐的 unicode 和不再支持的非 unicode 一起使用(相应地更改了 Configuration Properties->General 中的项目属性)。此外,我使用了 wxWidgets 手册推荐的多线程 DLL /MD 和 /MDd 链接。
编辑:也尝试使用 \MT 和 \MTd,效果相同。
从以上所有内容中,我在编译我的应用程序时得到了下面列出的相同链接器错误。请告诉我该怎么做,因为我的想法已经用完了......
此外,作为最后的手段,我使用来自 ../build/msw 文件夹的转换后的 MSVS 项目构建了整个东西,但它给了我相同的结果。
调试编译
1>hworld.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxApp::Initialize(int &,unsigned short * *)" (?Initialize@wxApp@@UAE_NAAHPAPAG@Z)
1>hworld.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsoleBase::OnAssertFailure(unsigned short const *,int,unsigned short const *,unsigned short const *,unsigned short const *)" (?OnAssertFailure@wxAppConsoleBase@@UAEXPBGH000@Z)
1>hworld.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsoleBase::OnAssert(unsigned short const *,int,unsigned short const *,unsigned short const *)" (?OnAssert@wxAppConsoleBase@@UAEXPBGH00@Z)
1>hworld.obj : error LNK2001: unresolved external symbol "unsigned short const * const wxEmptyString" (?wxEmptyString@@3PBGB)
1>hworld.obj : error LNK2019: unresolved external symbol "private: static struct wxString::SubstrBufFromType<class wxScopedCharTypeBuffer<unsigned short> > __cdecl wxString::ConvertStr(char const *,unsigned int,class wxMBConv const &)" (?ConvertStr@wxString@@CA?AU?$SubstrBufFromType@V?$wxScopedCharTypeBuffer@G@@@1@PBDIABVwxMBConv@@@Z) referenced in function "private: static class wxScopedCharTypeBuffer<unsigned short> __cdecl wxString::ImplStr(char const *,class wxMBConv const &)" (?ImplStr@wxString@@CA?AV?$wxScopedCharTypeBuffer@G@@PBDABVwxMBConv@@@Z)
1>hworld.obj : error LNK2019: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,unsigned short const *)" (?wxOnAssert@@YAXPBDH00PBG@Z) referenced in function "public: void __thiscall wxControlContainerBase::SetContainerWindow(class wxWindow *)" (?SetContainerWindow@wxControlContainerBase@@QAEXPAVwxWindow@@@Z)
1>wxpngd.lib(wxpng_pngread.obj) : error LNK2019: unresolved external symbol _inflateInit_ referenced in function _png_create_read_struct_2
1>wxpngd.lib(wxpng_pngread.obj) : error LNK2019: unresolved external symbol _inflate referenced in function _png_read_row
1>wxpngd.lib(wxpng_pngrutil.obj) : error LNK2001: unresolved external symbol _inflate
1>wxpngd.lib(wxpng_pngread.obj) : error LNK2019: unresolved external symbol _inflateEnd referenced in function _png_read_destroy
1>wxpngd.lib(wxpng_png.obj) : error LNK2019: unresolved external symbol _crc32 referenced in function _png_reset_crc
1>wxpngd.lib(wxpng_png.obj) : error LNK2019: unresolved external symbol _inflateReset referenced in function _png_reset_zstream
1>wxpngd.lib(wxpng_pngrutil.obj) : error LNK2001: unresolved external symbol _inflateReset
1>wxpngd.lib(wxpng_pngwrite.obj) : error LNK2019: unresolved external symbol _deflate referenced in function _png_write_flush
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflate
1>wxpngd.lib(wxpng_pngwrite.obj) : error LNK2019: unresolved external symbol _deflateEnd referenced in function _png_write_destroy
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2001: unresolved external symbol _deflateEnd
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2019: unresolved external symbol _deflateInit2_ referenced in function _png_zlib_claim
1>wxpngd.lib(wxpng_pngwutil.obj) : error LNK2019: unresolved external symbol _deflateReset referenced in function _png_zlib_release
发布编译
1>wxpng.lib(wxpng_png.obj) : 错误 LNK2001: 无法解析的外部符号 _crc32 1>wxpng.lib(wxpng_png.obj) : 错误 LNK2001: 无法解析的外部符号 _inflateReset 1>wxpng.lib(wxpng_pngrutil.obj) : 错误 LNK2001:未解析的外部符号 _inflateReset 1>wxpng.lib(wxpng_pngread.obj):错误 LNK2001:未解析的外部符号inflateInit 1>wxpng.lib(wxpng_pngread.obj):错误 LNK2001:无法解析的外部符号 _inflate 1>wxpng.lib(wxpng_pngrutil.obj):错误 LNK2001:无法解析的外部符号 _inflate 1>wxpng.lib(wxpng_pngread.obj):错误 LNK2001:未解析的外部符号_inflateEnd 1>wxpng.lib(wxpng_pngwrite.obj):错误LNK2001:未解析的外部符号_deflate 1>wxpng.lib(wxpng_pngwutil.obj):错误LNK2001:未解析的外部符号_deflate 1>wxpng.lib(wxpng_pngwrite.obj) : 错误 LNK2001: 无法解析的外部符号 _deflateEnd 1>wxpng.lib(wxpng_pngwutil.obj) : 错误 LNK2001: 无法解析的外部符号 _deflateEnd 1>wxpng.lib(wxpng_pngwutil.obj) : 错误 LNK2001: 无法解析的外部符号deflateInit2 1>wxpng.lib(wxpng_pngwutil.obj) : 错误 LNK2001: 无法解析的外部符号 _deflateReset 1>MSVCRT.lib(crtexe.obj) : 错误 LNK2001: 无法解析的外部符号 _main