#include <iostream>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
I used headers shown above. Cannot find help on Boost Official website.
To compile anything in Boost, you need a directory containing the boost/ subdirectory in your #include path. depending on your preference regarding the use of angle bracket includes. Don't be distracted by the doc/ subdirectory; it only contains a subset of the Boost documentation. Start with libs/index.
Boost can't be used with C as it uses OOP features from C++. It may be technically possible to develop a wrapper for it.
Assuming no errors in your code, you need to link the correct boost libraries: boost_thread, boost_system, and boost_date_time are the ones you've referenced, so
#include <iostream>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main()
{
}
This program compiles with the following command:
g++ -o test test.cc -lboost_system -lboost_date_time -lboost_thread
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With