首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >奇怪的LNK2001链接器错误

奇怪的LNK2001链接器错误
EN

Stack Overflow用户
提问于 2012-02-03 17:31:03
回答 1查看 697关注 0票数 0

昨天我收到了这个链接器错误。我已经在谷歌和msdn上搜索过,但都没有成功。我的问题:我已经将cpp项目的一些部分移到了外部静态库中。我将h文件添加到主项目中,并将依赖项添加到lib文件中。不幸的是,我收到了很多链接器错误。

代码语言:javascript
复制
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NFile::NFind::CFileInfo::Find(unsigned short const *)" (?Find@CFileInfo@NFind@NFile@NWindows@@QAE_NPBG@Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: class NWindows::NCOM::CPropVariant & __thiscall NWindows::NCOM::CPropVariant::operator=(unsigned short const *)" (??4CPropVariant@NCOM@NWindows@@QAEAAV012@PBG@Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CInFileStream::Open(unsigned short const *)" (?Open@CInFileStream@@QAE_NPBG@Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NFile::NIO::COutFile::Create(unsigned short const *,bool)" (?Create@COutFile@NIO@NFile@NWindows@@QAE_NPBG_N@Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "void __cdecl ConvertUInt32ToString(unsigned int,unsigned short *)" (?ConvertUInt32ToString@@YAXIPAG@Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NDLL::CLibrary::Load(unsigned short const *)" (?Load@CLibrary@NDLL@NWindows@@QAE_NPBG@Z)

所有这些方法都是我的外部库的一部分。我尝试了很多编译器设置,但都没有成功。此外,当我从链接器中完全删除库依赖项时,我得到了26 LNK2001错误。所以链接器只找到库的“部分”。我的项目是否使用了错误的编译器/链接器选项?

编辑:问题出在方法CLibrary::Load(LPCTSTR fileName)的参数define LPCTSTR上。在我的库中,我将选项“视wchar_t为内置类型(属性->C/C++->语言-> ... )”设置为“否”,现在它可以工作了。

EN

回答 1

Stack Overflow用户

发布于 2012-02-03 18:59:08

问题中没有足够的信息,所以我的回答只是一个指导。

bool NWindows::NFile::NFind::CFileInfo::Find(unsigned short const *)为例,在你的代码中找到它的定义。它在那里吗?使用这个确切的函数签名?它是否在未命名的命名空间中?在源文件中声明它是静态的吗?

另外,尝试完全重建所有内容。你会惊讶于完全重建会让神秘的问题消失多少次。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9126415

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档