I'm trying the simple example of boost multiprecision in c++ without installing it on my computer (using it header only).
//func.cpp
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
int main()
{
using namespace boost::multiprecision;
int128_t v = 1;
// Do some fixed precision arithmetic:
for(unsigned i = 1; i <= 20; ++i)
v *= i;
std::cout << v << std::endl; // prints 20!
// Repeat at arbitrary precision:
cpp_int u = 1;
for(unsigned i = 1; i <= 100; ++i)
u *= i;
std::cout << u << std::endl; // prints 100!
return 0;
}
I'm running ubuntu and I've copied the boost folder into the main folder I'm trying to run func.cpp in. I then run:
g++ -I/boost/ -o func func.cpp
I get the error
In file included from func.cpp:28:
boost/multiprecision/cpp_int.hpp:11:10: fatal error: boost/cstdint.hpp: No such file or directory
11 | #include <boost/cstdint.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
It appears that cpp_int.hpp is #include-ing a header that is located one directory above it (inside the boost folder I copied in, I've checked, it's there). I'm probably missing something basic since I get the same type of errors when trying to use other packages.