我正在尝试.lib
在我的 Visual Studio 2012 C++ 项目中包含一个文件。该库是具体的 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;
}