'How to add Boost c++ into a makefile

I am using boost/multiprecision/cpp_int.hpp within class of a cpp file boost.cpp

My main in in practice.cpp

How do i add the Boost into the make file

The current make file looks like this:

practice.exe        :   practice.o 
    g++ -Wall -O2 practice.cpp -lws2_32 -o practice.exe 
            
practice.o      :   practice.cpp 
    g++ -c -O2 -Wall practice.cpp
    
clean:
    del *.o
    del *.exe


Solution 1:[1]

So, the general idea is to just system install boost and let the compiler find it in the default include paths.

E.g. on a debian

 apt install libboost-all-dev

Should be enough. Boost Multiprecision itself is header-only. So if you only need cpp_int, cpp_dec_float and cpp_bin_float, you're done. You might want GMP/MPFR support, in which case you need to link those libraries with the additional linker flags -lgmp or -lmpfr.

If you need Serialization support, also link -lboost_serialization which would be installed in the default library paths with the system-wide Boost package we installed at the start.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sehe