
Hi all, I have installed Boost 1.44 and I have a program from a tutorial I am trying to compile with out success. The program is as follows: =============================================================================== #include <iostream> #include <vector> #include <algorithm> #include <boost/shared_ptr.hpp> using namespace::std; struct Boost_Example { Boost_Example(int _x) : x (_x) { } ~Boost_Example() { std::cout << "Destroying Boost_Example x = " << x << "\n"; std::cout << endl << endl << " "; system("PAUSE"); cout << endl << endl; } int x; }; typedef boost::shared_ptr<Boost_Example> Boost_ExamplePtr; struct Boost_ExamplePtrOps { bool operator()(const Boost_ExamplePtr &a, const Boost_ExamplePtr &b) { return a->x < b->x; } void operator()(const Boost_ExamplePtr &a) { std::cout << " " << a->x; } }; int main() { std::vector<Boost_ExamplePtr> Boost_Example_Vector; Boost_Example_Vector.push_back(Boost_ExamplePtr(new Boost_Example(3))); Boost_Example_Vector.push_back(Boost_ExamplePtr(new Boost_Example(2))); Boost_Example_Vector.push_back(Boost_ExamplePtr(new Boost_Example(1))); // std::cout << endl << endl; std::cout << " Original Boost_Example_Vector" ; std::for_each(Boost_Example_Vector.begin(), Boost_Example_Vector.end(), Boost_ExamplePtrOps()); std::cout << "\n"; // std::sort(Boost_Example_Vector.begin(), Boost_Example_Vector.end(), Boost_ExamplePtrOps()); std::cout << endl << endl; std::cout << "Sorted Boost_Example_vector: " ; std::for_each(Boost_Example_Vector.begin(), Boost_Example_Vector.end(), Boost_ExamplePtrOps()); std::cout << " \n"; // std::cout << endl << endl << " " ; system("PAUSE"); std::cout << endl << endl; // return 0; } ============================================================================= Just create an empty VC++ project and add a source file to it. Then paste this code in the source file. I believe that, if Boost is correctly installed on one's machine, this should compile correctly. For additional information, I have set up the include and lib directories as under: includes: $(BOOST_ROOT)boost libs $(BOOST_ROOT)stage\lib $(BOOST_ROOT)libs $(BOOST_ROOT)bin.v2 In the above paths, $(BOOST_ROOT) is added to "System Variables" under the "Environment Variables" as C:\Program Files\boost\boost_1_44_0 where it is installed. Shall a "\" be added in the end? Or shall this variable be added to "Path variables" instead of "System variables"? I believe that my environment is rightly setup. But I am still having problems building a simple console application. I am using Visual Studio 2008 on Windows 7. Please let me know, what to do and where to check for the missing block? Thanks and regards, Bhushan