- 1 year ago
Unresolved external symbol bcrypt_gensalt
The unresolved external symbol bcrypt_gensalt
indicates that the linker cannot find the implementation of the bcrypt_gensalt
function. This function is part of the Windows Cryptographic API: Next Generation (CNG) library, specifically the bcrypt hashing functions.
To resolve this issue, you need to link against the bcrypt
library when compiling your code. Here are the steps to do that:
Ensure that you have the Windows 8 SDK or later installed on your system. The bcrypt library is included in these SDKs.
Update your build configuration to include the
bcrypt
library when linking your code. The exact steps depend on the development environment and build system you are using. Here are a few common scenarios:Visual Studio: Right-click on your project, go to "Properties" > "Linker" > "Input", and add
bcrypt.lib
to the "Additional Dependencies" field.GCC (MinGW): Add
-lbcrypt
to your linker command line.CMake: Use the
target_link_libraries
command to link againstbcrypt
. For example:cmaketarget_link_libraries(your_project_name bcrypt)
Rebuild your project and ensure that the
bcrypt
library is successfully linked.
By linking against the bcrypt
library, the linker should be able to resolve the bcrypt_gensalt
symbol and your code should compile and link successfully.