Compilation with Crypto ++ provided by Ubuntu

I tried installing Crypto ++ using apt-get: sudo apt-get install libcrypto++-dev libcrypto++-doc libcrypto++-utils . And then I tried to compile a very simple program, for example:

 #include <iostream> #include "aes.h" #include "modes.h" using namespace std; using namespace CryptoPP; int main() { cout << "Yo, man!" << endl; return 0; } 

The result is fatal error: aes.h: No such file or directory .

I am a new Ubuntu user (formerly Windows), so I did some research, but most people say that typing one command is enough to get the repository with the Crypto ++ library and make it work. Well, that is not in my case.

+7
compilation ubuntu crypto ++
source share
1 answer

If you installed the library as you said (using apt-get ), try the following:

 #include <crypto++/aes.h> #include <crypto/modes.h> 

Instead of this:

 #include "aes.h" #include "modes.h" 

You must use #include <crypto++/...> because Ubuntu installs them in its "system", which means that the preprocessor will search in certain places in a certain order when they are processed. Also see What is the difference between #include and #include "filename"? .

Also note that in Fedora and Red Hat you would use #include <cryptopp/...> rather than #include <crypto++/...> . If you are targeting several operating systems on Crypto ++, see How to change the path of an include file using autotools? .

+8
source share

All Articles