
Hi, I am using Boost for the first time and now i am stuck when i try to compile code in Linux. We have Linux RHEL 7.2 and g++ 2.96. I managed to execute the sample code Simple_ls in Windows VC++ 6, but when I try to compile the same code in Linux it gives me many errors. I am using follow command to compile my linux code. g++ -c -I /usr/local/include/boost-1_33_1/ -L /usr/local/lib Simple_ls.cpp I have attached a file which contains the error i am getting. I have never worked on Linux earlier, so i think most probably I am missing out on making some setting in Linux environment or macros If somebody can help me, I would be very grateful. :-)

prateek khanna <prateek@baysquare.com> writes:
Hi,
I am using Boost for the first time and now i am stuck when i try to compile code in Linux. We have Linux RHEL 7.2 and g++ 2.96. I managed to execute the sample code Simple_ls in Windows VC++ 6, but when I try to compile the same code in Linux it gives me many errors. I am using follow command to compile my linux code. g++ -c -I /usr/local/include/boost-1_33_1/ -L /usr/local/lib Simple_ls.cpp I have attached a file which contains the error i am getting. I have never worked on Linux earlier, so i think most probably I am missing out on making some setting in Linux environment or macros If somebody can help me, I would be very grateful. :-)
Hi Prateek, (Just adding the library name to the subject line so the author might notice. see http://www.boost.org/more/discussion_policy.htm#effective) I am guessing there's a missing #include in the filesystem library and that you may be able to work around it by adding #include <boost/type_traits/is_function.hpp> before you #include any filesystem headers. However, only Beman can say for sure.
/usr/local/include/boost-1_33_1/boost/mpl/if.hpp: 67: instantiated from `boost::mpl::and_<boost::is_POD<boost::filesystem::path>, boost::detail::iterator_writability_disabled<boost::filesystem::path, boost::filesystem::path &>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >' /usr/local/include/boost-1_33_1/boost/mpl/if.hpp: 67: instantiated from `boost::mpl::aux::nested_type_wknd<boost::mpl::and_<boost::is_POD<boost::filesystem::path>, boost::detail::iterator_writability_disabled<boost::filesystem::path, boost::filesystem::path &>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> > >' /usr/local/include/boost-1_33_1/boost/mpl/if.hpp: 67: instantiated from `boost::mpl::not_<boost::mpl::and_<boost::is_POD<boost::filesystem::path>, boost::detail::iterator_writability_disabled<boost::filesystem::path, boost::filesystem::path &>, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> > >' /usr/local/include/boost-1_33_1/boost/mpl/if.hpp: 67: instantiated from `boost::detail::use_operator_brackets_proxy<boost::filesystem::path, boost::filesystem::path &>' /usr/local/include/boost-1_33_1/boost/mpl/if.hpp: 67: instantiated from `boost::mpl::if_<boost::detail::use_operator_brackets_proxy<boost::filesystem::path, boost::filesystem::path &>, boost::detail::operator_brackets_proxy<boost::filesystem::directory_iterator>, boost::filesystem::path>' /usr/local/include/boost-1_33_1/boost/iterator/iterator_facade.hpp: 391: instantiated from `boost::detail::operator_brackets_result<boost::filesystem::directory_iterator, boost::filesystem::path, boost::filesystem::path &>' /usr/local/include/boost-1_33_1/boost/iterator/iterator_facade.hpp: 654: instantiated from `boost::iterator_facade<boost::filesystem::directory_iterator, boost::filesystem::path, boost::single_pass_traversal_tag, boost::filesystem::path &, ptrdiff_t>' /usr/local/include/boost-1_33_1/boost/filesystem/operations.hpp: 110: instantiated from here /usr/local/include/boost-1_33_1/boost/type_traits/is_enum.hpp: 123: base class `boost: :type_traits::is_function_ptr_helper<boost::filesystem::path *>' has incomplete type
-- Dave Abrahams Boost Consulting www.boost-consulting.com

prateek khanna wrote:
Hi,
I am using Boost for the first time and now i am stuck when i try to compile code in Linux. We have Linux RHEL 7.2 and g++ 2.96. I managed to execute the sample code Simple_ls in Windows VC++ 6, but when I try to compile the same code in Linux it gives me many errors. I am using follow command to compile my linux code. g++ -c -I /usr/local/include/boost-1_33_1/ -L /usr/local/lib Simple_ls.cpp I have attached a file which contains the error i am getting. I have never worked on Linux earlier, so i think most probably I am missing out on making some setting in Linux environment or macros If somebody can help me, I would be very grateful. :-)
You're missing a C++ compiler. So called gcc "2.96" is not an official gcc release. It has been created by a Linux distributor by adding tons of patches to gcc 2.95.x. Those patches made gcc "2.96" even worse than gcc 2.95 was. gcc 2.95 and "2.96" are pre-standard compilers and way outdated. Please consider getting a more recent compiler. This will likely solve your current problem and it will definitely avoid a lot of other problems you will run into by using gcc "2.96". I suggest you try gcc 3.4.6 or gcc 4.1.1. Beware, though, that if you're planning to link against prebuilt C++ libraries of your Linux distribution then you have to stick to the compiler used by the distribution (that limit does not exist for C libraries used by your application). In that case, you probably should upgrade your system generally in order to get rid of the legacy stuff. HTH, m Send instant messages to your online friends http://au.messenger.yahoo.com

prateek khanna wrote:
I am using Boost for the first time and now i am stuck when i try to compile code in Linux. We have Linux RHEL 7.2 and g++ 2.96.
As Martin Wille pointed out, RHEL 7.2 and g++ 2.96 are many years out-of-date and have many problems with Boost and probably other modern C++ code.
I managed to execute the sample code Simple_ls in Windows VC++ 6...
VC++ 6 is also years out-of-date and *very* noncompliant as regards the C++ standard. Both GCC and VC++ 8.0 (Express edition) are free for the download. Do yourself a favor and upgrade to modern compilers. Both are very standards compliant. --Beman
participants (4)
-
Beman Dawes
-
David Abrahams
-
Martin Wille
-
prateek khanna