Friday, December 18, 2015

Getting Code::Blocks to work with std_lib_facilities.h

In Stroustrup's book, 'Programming: Principles and Practice Using C++', one must include the header file. This won't work in Code::Blocks without some modification.

First, go to settings→compiler→ and make sure 'Have g++ follow the C++11 ISO C++ language standard' is checked.

Then comment out or delete the following  in the std_lib_facilities.h as shown below:

#ifdef _MSC_VER
 // microsoft doesn't yet support C++11 inheriting constructors
 Vector() { }
 explicit Vector(size_type n) :std::vector<T>(n) {}
 Vector(size_type n, const T& v) :std::vector<T>(n,v) {}
 template <class I>
 Vector(I first, I last) : std::vector<T>(first, last) {}
 Vector(initializer_list<T> list) : std::vector<T>(list) {}
#else
 using std::vector<T>::vector; // inheriting constructor
#endif 

Source: http://www.cplusplus.com/forum/general/136389/

No comments:

Post a Comment