I'm new to c++ and currently trying to create QT login-register GUI app with hashing passwords. For Bcrypt I'm using this library
So, I copied it, created binaries with CMake GUI and than builded them with VS2019. Then added following code into QT .pro file:
LIBS += -L"S:/work/proga/includes/Bcrypt.cpp/build/Release/" -lbcrypt
INCLUDEPATH += S:/work/proga/includes/Bcrypt.cpp/include
and some basic code in main.cpp (include and usage of lib)
But faced errors like this:
:-1: error: release/main.o:main.cpp:(.text+0x122): undefined reference to `bcrypt::generateHash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
So. How I should fix it?
upd, my .pro file:
QT += core gui sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
SOURCES += \
main.cpp \
loginwindow.cpp \
profileinfo.cpp \
registerwindow.cpp \\
HEADERS += \
User.h \
loginwindow.h \
profileinfo.h \
registerwindow.h \\
FORMS += \
loginwindow.ui \
profileinfo.ui \
registerwindow.ui
LIBS += -L"S:/work/proga/includes/Bcrypt.cpp/build/Release/" -lbcrypt
INCLUDEPATH += S:/work/proga/includes/Bcrypt.cpp/include
main.cpp like
#include <iostream>
#include <bcrypt.h>
int main(int argc, char *argv[])
{
std::string password = "top_secret";
std::string hash = bcrypt::generateHash(password);
std::cout << "Hash: " << hash << std::endl;
std::cout << "\"" << password << "\" : " << bcrypt::validatePassword(password,hash) << std::endl;
std::cout << "\"wrong\" : " << bcrypt::validatePassword("wrong",hash) << std::endl;
}
<3
Tried to use another bcrypt lib (this), but also faced undefined reference errors. Maybe I'm dumb (yes), but can't understand what I should do now..
Tryed to read about this such of error, but didn't find any solution for me (I'm dumb)
BCrypt::generateHash(password);so this additional C++ wrapper from github.com/hilch/Bcrypt.cpp seems redundant.