当我调试致命错误时,我正在尝试学习SQLite3 API。知道我将链接器配置为将其编译为控制台。
错误1错误LNK2019:函数_main ....\"filename".obj中引用的未解析外部符号_CryptUnprotectData@28 错误2错误LNK1120: 1未解决的外部调试\“文件名”.exe
以下是代码:
#include <stdio.h>
#include <conio.h>
#include "sqlite3.h"
#include <stdlib.h>
#include <Windows.h>
int main()
{
sqlite3_initialize();
sqlite3 *sqlHandle;
int call;
char *tail = NULL;
sqlite3_stmt *stmt = NULL;
const FILE *fileHandle = "C:\\Users\\"username"\\Desktop\\Data.sqlite";
call = sqlite3_open_v2(fileHandle, &sqlHandle, SQLITE_OPEN_READONLY,NULL);
if (call != SQLITE_OK)
{
sqlite3_close(sqlHandle);
exit(EXIT_SUCCESS);
}
//preparing statement to be executed
if (sqlite3_prepare_v2(sqlHandle, "SELECT action_url,username_value,password_value FROM logins", sizeof(char)*60, &stmt, &tail) != SQLITE_OK)
{
sqlite3_close(sqlHandle);
printf("Can't retrieve data: %s\n", sqlite3_errmsg(sqlHandle));
}
CRYPT_INTEGER_BLOB *blob;
CRYPT_INTEGER_BLOB *UnprotectedBlob = NULL;
while (sqlite3_step(stmt) == SQLITE_ROW)
{
blob = sqlite3_column_text(stmt, 2);
if (CryptUnprotectData(blob, NULL, NULL, NULL, NULL, 0, UnprotectedBlob))
{
printf("%s | %s | %s \n",
sqlite3_column_text(stmt, 0),
sqlite3_column_text(stmt, 1),
UnprotectedBlob->cbData);
}
}
sqlite3_finalize(stmt);
sqlite3_close(sqlHandle);
sqlite3_shutdown();
_getch();
return 1;
}发布于 2014-04-05 19:56:14
您需要链接到CryptoAPI库。您可以通过链接器的项目属性(Configuration Properties > Linker > Input > Additional dependencies)或使用#pragma指令的代码来实现这一点。
#pragma comment(lib, "Crypt32")https://stackoverflow.com/questions/22885950
复制相似问题