c++gccbotan

include botan 2 in compilation


i try include some botan header in compilation process

#include <botan/rng.h>
#include <botan/auto_rng.h>
#include <botan/cipher_mode.h>
#include <botan/hex.h>
#include <iostream>

int main(int argc, char** argv)
{
        return 0;
}

I found that i need to compile with following command in order to build successfully

g++ app.cpp -I/usr/local/include/botan-2

i saw some folks execute

g++ app.cpp -lbotan-2

i tried it out but i get a error

'app.cpp:1:10: fatal error: botan/rng.h: No such file or directory
 #include <botan/rng.h>

Am i missing anything ?


Solution

  • The following command:

    g++ app.cpp -lbotan-2
    

    links botan-2 with app.cpp but you still need to specify where to find the headers:

    g++ app.cpp -I/usr/local/include/botan-2 -lbotan-2 
    

    Under my system, the headers for botan-2 are in /usr/include/botan-2. So, make sure you are giving the right path.