简体   繁体   English

Crypto++ Code::blocks 未定义的引用问题

[英]Crypto++ Code::blocks Undefined reference problem

I'm trying to create a C++ program using Crypto++ (with Code::Blocks), but keep getting stuck with the same problem.我正在尝试使用 Crypto++(使用 Code::Blocks)创建一个 C++ 程序,但一直遇到同样的问题。 I'm using a cut-down version of this code: http://andreyvitdev.blogspot.com/2005/10/crypto-usage-sample.html , but I can't get it to compile.我正在使用此代码的精简版: http://andreyvitdev.blogspot.com/2005/10/crypto-usage-sample.html ,但我无法编译。

#include "cryptopp/blowfish.h"
#include "cryptopp/osrng.h"

using namespace CryptoPP;

int main (int argc, char** argv) {

    byte key[Blowfish::DEFAULT_KEYLENGTH],
            iv[Blowfish::BLOCKSIZE];

    AutoSeededRandomPool rng (true);
    rng.GenerateBlock(key, sizeof (key));
    rng.GenerateBlock(iv, sizeof (iv));

}

I get multiple errors, starting with: "C:\Users\Utilisateur\Programming\C++\CodeBlocks\Crytp tester\main.cpp|13|undefined reference to `CryptoPP::RandomNumberGenerator::GenerateBlock(unsigned char*, unsigned int)'"我收到多个错误,开头为:“C:\Users\Utilisateur\Programming\C++\CodeBlocks\Crytp tester\main.cpp|13|undefined reference to `CryptoPP::RandomNumberGenerator::GenerateBlock(unsigned char*, unsigned int) '"

Am I missing something?我错过了什么吗? There are many references on different sites to libraries that must be imported, but I couldn't figure out where they were in the crypto++ folder: http://www.cryptopp.com/#download不同站点上有许多必须导入的库的引用,但我无法弄清楚它们在 crypto++ 文件夹中的位置: http://www.cryptopp.com/#download

"Undefined reference" is a linker error -- either you didn't build the Crypto++ library, or didn't tell the linker to link to it. “未定义的引用”是 linker 错误——要么您没有构建 Crypto++ 库,要么没有告诉 linker 链接到它。

I'm not positive if it will build using MinGW (the most common compiler with Code Blocks) though.不过,我不确定它是否会使用 MinGW(最常见的带有代码块的编译器)构建。 The Microsoft compilers (along with Visual Studio) are free; Microsoft 编译器(连同 Visual Studio)是免费的; and are tested explicitly with both Code::Blocks and Crypto++.并使用 Code::Blocks 和 Crypto++ 显式测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM