Build一个程序,提示error LNK2001错误,错误提示如下:
------ Rebuild All started: Project: HwMenu, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'HwMenu', configuration 'Debug|Win32'
Compiling...
HwMenuApp.cpp
MainWnd.cpp
Generating Code...
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
LINK : D:\........\Debug\HwMenu.exe not found or not built by the last incremental link; performing full link
HwMenuApp.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxApp::Initialize(int &,wchar_t * *)" (?Initialize@wxApp@@UAE_NAAHPAPA_W@Z)
HwMenuApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssertFailure(wchar_t const *,int,wchar_t const *,wchar_t const *,wchar_t const *)" (?OnAssertFailure@wxAppConsole@@UAEXPB_WH000@Z)
HwMenuApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssert(wchar_t const *,int,wchar_t const *,wchar_t const *)" (?OnAssert@wxAppConsole@@UAEXPB_WH00@Z)
D:\WORK\菜单识别\HwMenu\Debug\HwMenu.exe : fatal error LNK1120: 3 unresolved externals
Build log was saved at "file://d:\WORK\....\HwMenu\HwMenu\Debug\BuildLog.htm"
HwMenu - 4 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
有的朋友说是wxWidgets的预定义值没做好,在D:\opt\wxWidgets-2.8.7\lib\vc_lib\mswd\wx的setup.h中,这也是一个思路,但是我的sample中的minimal可以编译通过。各种该加载的库都加载了,还是无法解决此问题。
从错误提示来看,应该是unicode的事情,我在编译时没有选择unicode编译。为什么会出现这个问题呢?
在VS中找来找去,终于找到了,在项目属性中,Configuration Properties->General中,有一个属性:
Project Defaults-> Character Set,好,问题就出现在这里,这里的默认选项是Use Unicode Character Set.
改为:Not Set就好了。
发表于 @ 2008年05月13日 15:20:12|评论(loading...)|编辑