dimanche 10 septembre 2017

Codeblocks IDE can't detect C++11 features, unique_ptr

Would anyone know why Code::Blocks IDE doesn't recognise std::unique_ptr and std::shared_ptr? I have included both < memory> and < memory.h> headers, and in the settings under the GNU GCC compiler settings have ticked the box that says

"Have g++ follow the C++11 ISO C++ language standard [-std=c++11]"

It seems that the definitions aren't in the included < memory> or < memory.h> headers, and the autocomplete does not detect them. I am on Ubuntu, and have tried updating my version of Code::Blocks and also reinstalled it. The only smart pointer the autocomplete detects is the std::auto_ptr, which I believe is now deprecated.

The < memory> header only defines one function, "align()", and the includes are as follows:

#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_tempbuf.h>
#include <bits/stl_raw_storage_iter.h>

#if __cplusplus >= 201103L
#  include <exception>            // std::exception
#  include <typeinfo>             // std::type_info in get_deleter
#  include <iosfwd>               // std::basic_ostream
#  include <ext/atomicity.h>
#  include <ext/concurrence.h>
#  include <bits/functexcept.h>
#  include <bits/stl_function.h>  // std::less
#  include <bits/uses_allocator.h>
#  include <type_traits>
#  include <functional>
#  include <debug/debug.h>
#  include <bits/unique_ptr.h>
#  include <bits/shared_ptr.h>
#  include <bits/shared_ptr_atomic.h>
#  if _GLIBCXX_USE_DEPRECATED
#    include <backward/auto_ptr.h>
#  endif
#else
#  include <backward/auto_ptr.h>
#endif

If I can't get this to work, I guess I'll have to use another IDE. Thanks.

Aucun commentaire:

Enregistrer un commentaire