簡體   English   中英

2嘗試編譯bcrypt項目時出錯

[英]2 Errors when trying to compile the bcrypt project

我正在使用bcrypt庫並獲取這些錯誤:

錯誤LNK2019未解析的外部符號bcrypt_gensalt在函數“public:static class std :: basic_string,class std :: allocator> cdecl BCrypt :: generateHash(class std :: basic_string,class std :: allocator> const&,int)”中引用“( ?generateHash @ @@ BCrypt SA?AV?$ basic_string的@ DU?$ char_traits @ d @ @@ STD V'$分配器@ d @ @@ 2 STD @@ AEBV23 3 H @ Z)

錯誤LNK2019未解析的外部符號bcrypt_hashpw在函數“public:static class std :: basic_string,class std :: allocator> cdecl BCrypt :: generateHash(class std :: basic_string,class std :: allocator> const&,int)”中引用“( ?generateHash @ @@ BCrypt SA?AV?$ basic_string的@ DU?$ char_traits @ d @ @@ STD V'$分配器@ d @ @@ 2 STD @@ AEBV23 3 H @ Z)

這是我的測試代碼:

#include <iostream>
#include "bcrypt/BCrypt.hpp"

BCrypt bcrypt;

using namespace std;

int main() {
    string password = "test";
    string hash = bcrypt.generateHash(password);
    cout << bcrypt.validatePassword(password, hash) << endl;
    cout << bcrypt.validatePassword("test1", hash) << endl;
}

我用過這段代碼

#include <iostream>
#include "bcrypt/BCrypt.hpp"

BCrypt bcrypt;

using namespace std;

int main() {

    string password = "test";
    string hash = bcrypt.generateHash(password);
    cout << bcrypt.validatePassword(password, hash) << endl;
    cout << bcrypt.validatePassword("test1", hash) << endl;

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM