I wrote a test.cpp:
#include <iostream>
#include <stack>
#include <boost/lexical_cast.hpp>
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
using namespace std;
namespace phoenix = boost::phoenix;
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
struct calculator
{
bool interpret(const string& s);
void do_neg();
void do_add();
void do_sub();
void do_mul();
void do_div();
void do_number(const char* first, const char* last);
int val() const;
private:
stack<int> values_;
int *pn1_, n2_;
void pop_1();
void pop_2();
};
......................
....................
But when I use g++ test.cpp -o test, there are errors like boost/lexical_cast.hpp: No such file or directory, but I have copy all of files in boost (download from boost.org) to the test.cpp folder, how to make g++ know the headers paths? Thanks
I used g++ test.cpp -o test
Using " " is not possible, I have a lot of header’s dependency.
You have to make sure you modify the include to g++’s command. Reading from the man page (which is your best friend for this sorta stuff):
For you the command should look like this: