错误LNK2001未解析的外部符号“public:void __thiscall ...” [英] Error LNK2001 unresolved external symbol "public: void __thiscall ..."

查看:371
本文介绍了错误LNK2001未解析的外部符号“public:void __thiscall ...”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个编译成动态dll的项目。某些函数不会在此dll中导出。

I have a project which is compiled into a dynamic dll. Some functions are not exported in this dll.

我创建了一个单独的单元测试项目,并按照指令链接.lib文件。

I create a separate unit test project and follow the instruction to link .lib file.



  1. 选择  配置属性 >  链接器 >  输入  >  额外的
    依赖关系

  1. Choose Configuration Properties > Linker > Input > Additional Dependencies.

选择  编辑,并添加  。obj  或 LIB  文件。不要使用完整路径名。

Choose Edit, and add the names of the .obj or .lib files. Do not use the full path names.

选择  ; 配置属性 >  链接器 >  常规 >  其他
图书馆目录

Choose Configuration Properties > Linker > General > Additional Library Directories.

选择  编辑,然后添加  的目录路径.obj  或  。lib  文件。该路径通常位于待测项目的构建文件夹
内。

Choose Edit, and add the directory path of the .obj or .lib files. The path is typically within the build folder of the project under test.

选择  配置属性 >  VC ++目录 >  包含目录

Choose Configuration Properties > VC++ Directories > Include Directories.

选择  编辑,然后添加待测项目的标题目录。

Choose Edit, and then add the header directory of the project under test.

但是我仍然得到错误"未解析的外部符号"public:void __thiscall CCommon :: SetParms()..."。这里CCommon :: SetParms()是一个非导出函数。

However I still get error "unresolved external symbol "public: void __thiscall CCommon::SetParms() ...". Here CCommon::SetParms() is a non-exported function.

是否有任何错过导致此错误?

Is there anything missed to lead to this error?

推荐答案

您好luner10,

Hi luner10,

欢迎来到MSDN论坛。

Welcome to MSDN forum.

根据您的描述,请按照以下步骤操作重新添加dll文件

According to your description, please follow the below steps to re-add the dll file

Step1#配置属性> C / C ++>一般>附加包含方向

选择编辑,然后添加dll标题的目录

Choose Edit, and add the directory of your dll header

Step2#  Configuration Properties> ;接头>输入>附加依赖性

选择编辑,并将[lib Name] .lib添加到列表中

Choose Edit, and add the [lib Name].lib to the list

Step3# 配置属性>接头>一般>其他库依赖性

选择编辑,然后添加.lib目录

Choose Edit, and add the directory of .lib

预计会有任何反馈。

最好的问候,

Dylan


这篇关于错误LNK2001未解析的外部符号“public:void __thiscall ...”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆