我正在尝试编译使用wxWidgets库创建的现有项目。 我成功编译了wxWidgets 2.8.12库。 现在,我正在尝试编译我的项目。 但我得到错误:
fatal error LNK1104: cannot open file 'wxbase28d.lib'
之后我在以下设置中添加了一些变量:
C / C ++ - >预处理器定义:
WIN32;__WXMSW__;_WINDOWS;_DEBUG;__WXDEBUG__;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
VC ++目录 - >包含目录:
D:\instantclient_12_1\sdk\include;$(WXWIN)\lib\vc_lib\mswd;$(WXWIN)\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;
链接器 - >常规 - >其他图书馆目录:
$(WXWIN)\lib\vc_lib;E:\app\vasyl\product\11.1.0\db_1\OCI\lib\MSVC\vc71;$(WXDIR284)\lib\vc_lib;%(AdditionalLibraryDirectories)
资源 - >常规 - >其他包含目录:
$(WXWIN)\include;c:\wxMSW284\include;$(WXDIR284)\include;%(AdditionalIncludeDirectories)
现在,情况是这样的:
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _realloc already defined in LIBCMTD.lib(dbgrealloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _memmove already defined in LIBCMTD.lib(memmove.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _tolower already defined in LIBCMTD.lib(tolower.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _isalpha already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _isdigit already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _isspace already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _strtol already defined in LIBCMTD.lib(strtol.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _strtoul already defined in LIBCMTD.lib(strtol.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __strtoi64 already defined in LIBCMTD.lib(strtoq.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __strtoui64 already defined in LIBCMTD.lib(strtoq.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __errno already defined in LIBCMTD.lib(dosmap.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __vsprintf_p already defined in LIBCMTD.lib(vsnprnc.obj)
...
...
etc.
有人能帮助我发现我做错了吗?
答案 0 :(得分:1)
您正在为项目和库使用不同的CRT设置(静态与DLL)。确保使用/MD[d]
或/MT[d]
相同的选项(重新)构建它们。
答案 1 :(得分:0)
此链接器错误可能有多种原因。要检查的第一个地址是MSDN:https://msdn.microsoft.com/en-us/library/ts7eyw4s.aspx
什么是$(WXWIN)
,它与$(WXDIR284)
的区别如何?看来,你包括两次wxWidgets路径......