1

I am running Ubuntu 12.04 LTS and installed libboost-filesystem1.48-dev. I also have included /usr/lib/libboost_filesystem-mt.a into my code. I want to use the Boost library to check whether a directory exists or not. Adding the corresponding header file

#include "boost/filesystem.hpp"
using namespace boost::filesystem;

into my program gives me weird compile error as following:

22:42:22 **** Incremental Build of configuration gcc-debug for project VENTOS ****
make MODE=debug CONFIGNAME=gcc-debug all 
cd application && make all
make[1]: Entering directory `/home/mani/Desktop/VENTOS/application'
Global_03_Statistics.cc
In file included from /usr/include/boost/filesystem/v3/path_traits.hpp:23:0,
                 from /usr/include/boost/filesystem/v3/path.hpp:25,
                 from /usr/include/boost/filesystem.hpp:35,
                 from ./Global_01_TraCI_Extend.h:12,
                 from ./Global_03_Statistics.h:13,
                 from Global_03_Statistics.cc:2:
/usr/include/boost/system/error_code.hpp:188:45: error: expected ‘)’
/usr/include/boost/system/error_code.hpp:188:45: error: expected ‘)’
/usr/include/boost/system/error_code.hpp:188:45: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/error_code.hpp:188:45: error: cannot declare member function ‘cSimulation::getActiveEnvir’ within ‘boost::system::error_category’
/usr/include/boost/system/error_code.hpp:188:45: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/error_code.hpp:188:45: error: expected unqualified-id before ‘)’ token
/usr/include/boost/system/error_code.hpp:189:61: error: expected ‘)’
/usr/include/boost/system/error_code.hpp:189:61: error: expected ‘)’
/usr/include/boost/system/error_code.hpp:189:61: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/error_code.hpp:189:61: error: cannot declare member function ‘cSimulation::getActiveEnvir’ within ‘boost::system::error_category’
/usr/include/boost/system/error_code.hpp:189:61: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/error_code.hpp:189:61: error: expected unqualified-id before ‘)’ token
/usr/include/boost/system/error_code.hpp: In member function ‘std::string boost::system::error_condition::message() const’:
/usr/include/boost/system/error_code.hpp:263:79: error: passing ‘const boost::system::error_category’ as ‘this’ argument of ‘virtual std::string boost::system::error_category::message(...)’ discards qualifiers [-fpermissive]
/usr/include/boost/system/error_code.hpp: In member function ‘boost::system::error_condition boost::system::error_code::default_error_condition() const’:
/usr/include/boost/system/error_code.hpp:349:111: error: passing ‘const boost::system::error_category’ as ‘this’ argument of ‘virtual boost::system::error_condition boost::system::error_category::default_error_condition(...)’ discards qualifiers [-fpermissive]
/usr/include/boost/system/error_code.hpp: In member function ‘std::string boost::system::error_code::message() const’:
/usr/include/boost/system/error_code.hpp:350:79: error: passing ‘const boost::system::error_category’ as ‘this’ argument of ‘virtual std::string boost::system::error_category::message(...)’ discards qualifiers [-fpermissive]
/usr/include/boost/system/error_code.hpp: At global scope:
/usr/include/boost/system/error_code.hpp:485:73: error: ‘boost::system::error_category::default_error_condition’ declared as an ‘inline’ variable
/usr/include/boost/system/error_code.hpp:485:73: error: ‘boost::system::error_condition boost::system::error_category::default_error_condition’ is not a static member of ‘class boost::system::error_category’
/usr/include/boost/system/error_code.hpp:485:73: error: invalid cast from type ‘cEnvir’ to type ‘int’
/usr/include/boost/system/error_code.hpp:485:78: error: expected ‘,’ or ‘;’ before ‘const’
/usr/include/boost/system/error_code.hpp: In member function ‘virtual bool boost::system::error_category::equivalent(int, const boost::system::error_condition&) const’:
/usr/include/boost/system/error_code.hpp:493:44: error: passing ‘const boost::system::error_category’ as ‘this’ argument of ‘virtual boost::system::error_condition boost::system::error_category::default_error_condition(...)’ discards qualifiers [-fpermissive]
In file included from /usr/include/boost/filesystem/v3/path.hpp:27:0,
                 from /usr/include/boost/filesystem.hpp:35,
                 from ./Global_01_TraCI_Extend.h:12,
                 from ./Global_03_Statistics.h:13,
                 from Global_03_Statistics.cc:2:
/usr/include/boost/system/system_error.hpp: At global scope:
/usr/include/boost/system/system_error.hpp:36:25: error: expected ‘)’
/usr/include/boost/system/system_error.hpp:36:25: error: expected ‘)’
/usr/include/boost/system/system_error.hpp:36:25: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/system_error.hpp:36:25: error: cannot declare member function ‘cSimulation::getActiveEnvir’ within ‘boost::system::system_error’
/usr/include/boost/system/system_error.hpp:36:25: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/system_error.hpp:36:25: error: expected unqualified-id before ‘)’ token
/usr/include/boost/system/system_error.hpp:39:25: error: expected ‘)’
/usr/include/boost/system/system_error.hpp:39:25: error: expected ‘)’
/usr/include/boost/system/system_error.hpp:39:25: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/system_error.hpp:39:7: error: ‘boost::system::system_error::system_error(...)’ cannot be overloaded
/usr/include/boost/system/system_error.hpp:36:7: error: with ‘boost::system::system_error::system_error(...)’
/usr/include/boost/system/system_error.hpp:39:25: error: cannot declare member function ‘cSimulation::getActiveEnvir’ within ‘boost::system::system_error’
/usr/include/boost/system/system_error.hpp:39:25: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/system_error.hpp:39:25: error: expected unqualified-id before ‘)’ token
/usr/include/boost/system/system_error.hpp:43:25: error: expected ‘)’
/usr/include/boost/system/system_error.hpp:43:25: error: expected ‘)’
/usr/include/boost/system/system_error.hpp:43:25: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/system_error.hpp:43:7: error: ‘boost::system::system_error::system_error(...)’ cannot be overloaded
/usr/include/boost/system/system_error.hpp:36:7: error: with ‘boost::system::system_error::system_error(...)’
/usr/include/boost/system/system_error.hpp:43:25: error: cannot declare member function ‘cSimulation::getActiveEnvir’ within ‘boost::system::system_error’
/usr/include/boost/system/system_error.hpp:43:25: error: expected ‘;’ at end of member declaration
/usr/include/boost/system/system_error.hpp:43:25: error: expected unqualified-id before ‘)’ token
In file included from /usr/include/boost/filesystem/v3/path_traits.hpp:22:0,
                 from /usr/include/boost/filesystem/v3/path.hpp:25,
                 from /usr/include/boost/filesystem.hpp:35,
                 from ./Global_01_TraCI_Extend.h:12,
                 from ./Global_03_Statistics.h:13,
                 from Global_03_Statistics.cc:2:
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/Core/GenericPacketMath.h:289:18:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/Core/Assign.h:71:36:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/Core/util/BlasUtil.h:128:35:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/Core/DiagonalProduct.h:29:86:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/Core/IO.h:168:23:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/Core/TriangularMatrix.h:102:7:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp: In instantiation of ‘boost::decay<Eigen::internal::<anonymous enum> >’:
../eigen-3.2.1/Eigen/src/SVD/JacobiSVD.h:41:28:   instantiated from here
/usr/include/boost/type_traits/decay.hpp:28:66: error: ‘Eigen::internal::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:28:66: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
/usr/include/boost/type_traits/decay.hpp:38:17: error: ‘Eigen::internal::<anonymous enum>’ is/uses anonymous type
/usr/include/boost/type_traits/decay.hpp:38:17: error:   trying to instantiate ‘template<class T> struct boost::remove_reference’
Global_03_Statistics.cc: In member function ‘int Statistics::getNodeIndex(const char*)’:
Global_03_Statistics.cc:486:33: warning: NULL used in arithmetic [-Wpointer-arith]
make[1]: Leaving directory `/home/mani/Desktop/VENTOS/application'
make[1]: *** [../out/gcc-debug/application/Global_03_Statistics.o] Error 1
make: *** [application_dir] Error 2

The error is in the error_code.hpp file at

virtual std::string message( int ev ) const = 0;

Clicking on ev, brings me to the cenvir.h file which is defined by OMNET++ simulator (the simulator that I am coding in). In this header, ev is defined as

#define ev  (*cSimulation::getActiveEnvir())
ManiAm
  • 1,759
  • 5
  • 24
  • 43
  • 2
    Maybe use a system that doesn't go defining macros with stupid names such as `ev`? Or `#undef ev` before including boost. – Mankarse Jun 08 '14 at 06:48
  • 1
    Thanks! using #undef worked! I ran into another conflict between boost and eigen. This post solved my issue: http://stackoverflow.com/questions/5327325/conflict-between-boost-opencv-and-eigen-libraries – ManiAm Jun 08 '14 at 07:26

0 Answers0