Visual Studio 2012 - 尝试包含 .lib 时"Error LNK2019 unresolved external symbol"
Visual Studio 2012 - "Error LNK2019 unresolved external symbol" when attempting to include .lib
我正在尝试在我的Visual Studio 2012 C++项目中包含.lib
文件。具体来说,该库是pHash项目。我已将项目的头文件添加到Project->Properties->Configuration Properties->VC++ Directories->Includes
,并将.lib
文件的文件夹添加到Project->Properties->Configuration Properties->VC++ Directories->Library Directories
。 pHash.lib
已添加到 Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies
中的依赖项列表中。但是即使我已经完成了所有这些操作,在尝试使用库时仍然会收到此错误:error LNK2019: unresolved external symbol "int __cdecl ph_dct_imagehash(char const *,unsigned __int64 &)" (?ph_dct_imagehash@@YAHPBDAA_K@Z) referenced in function _main
。
我的代码如下所示:
#include <iostream>
#include "pHash.h"
using namespace std;
int ph_dct_imagehash(const char *file, ulong64 &hash);
int main()
{
ulong64 tmp = 0;
ulong64 &hash = tmp;
const char *file = "C:\users\user\desktop\img1.jpg";
ph_dct_imagehash(file, hash);
return 0;
}
你不需要原型
int ph_dct_imagehash(const char *file, ulong64 &hash);
包含pHash.h
后,后者将为您声明函数。
删除该行并检查任何编译器错误(如果有的话,这将是无法找到函数ph_dct_imagehash
)。也许您需要使用正确的命名空间作为前缀:
somephashnamespace::ph_dct_imagehash(file, hash);
相关文章:
- ERROR LNK2001 AND LNK2019
- "error LNK2019: unresolved external fatal"和"error LNK1120: 1 unresolved externals"
- error LNK2019 ARuco and OpenCV VS2010 c++
- 错误 : "error LNK2019: unresolved external symbol"
- 如何修复" Error LNK2019 : unresolved external symbol ... "
- 问题:"error LNK2019: unresolved external symbol"
- VS 2012 Error LNK2019
- LNK2019 error in C++
- C++ error LNK2019
- Visual Studio 2012 - 尝试包含 .lib 时"Error LNK2019 unresolved external symbol"
- 获取"error LNK2019: unresolved external symbol ... "
- DHCP C++ error LNK2019
- Visual Studio 2013 error LNK2019
- 我得到这个错误是Visual Studio C++ :: "error LNK2019: unresolved external symbol"
- LNK 1120 + LNK2019 Error
- visual studio lnk2019 and 1120 error
- 链接器错误"... .obj : error LNK2019: unresolved external symbol referenced in function"
- 获取"error LNK2019: unresolved external symbol"
- 6 "error LNK2019: unresolved external symbol"
- Visual C++ Error: LNK2019, LNK2028 and LNK1120