我试图使用apt-get:sudo apt-get install libcrypto++-dev libcrypto++-doc libcrypto++-utils安装Crypto++。然后我试着编译非常简单的程序,比如:
#include <iostream>
#include "aes.h"
#include "modes.h"
using namespace std;
using namespace CryptoPP;
int main()
{
cout << "Yo, man!" << endl;
return 0;
}它导致了fatal error: aes.h: No such file or directory.
我是一个新的Ubuntu用户(以前是Windows),所以我做了一些研究,但大多数人说,输入一个命令就足以获得Crypto++库的存储库并使其工作。我的情况不是这样的。
发布于 2013-10-18 15:28:40
如果按您所说的(使用apt-get)安装了库,请尝试如下:
#include <crypto++/aes.h>
#include <crypto/modes.h>而不是这样:
#include "aes.h"
#include "modes.h"您应该使用#include <crypto++/...>,因为Ubuntu将它们安装在它的"system“中,这意味着预处理程序在处理它们时将按照特定的顺序查看特定的位置。也见What is the difference between #include and #include “filename”?。
还请注意,在Fedora和Red上,您将使用#include <cryptopp/...>,而不是#include <crypto++/...>。如果要针对Crypto++的多个操作系统,请参见How to change the include file path with autotools?。
发布于 2021-12-24 18:05:00
确保还包括编译命令的-lcryptopp标志!
https://stackoverflow.com/questions/19187990
复制相似问题