osx - No type named 'nullptr_t' in namespace 'std' -
someone compiling qt program using c++11 standard , got error (mac os x / gcc). know can declare it, shouldn't in <cstddef>
?
./collectable_smartptr.hpp:54:33: error: no type named 'nullptr_t' in namespace 'std' void operator=(std::nullptr_t &null)
this code works fine on windows , linux, see on mac.
mac i386-apple-darwin11.3.0, compiler is:
$ g++ --version configured with: --prefix=/applications/xcode.app/contents/developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 apple llvm version 5.1 (clang-503.0.40) (based on llvm 3.4svn) target: x86_64-apple-darwin13.2.0 thread model: posix
g++ options (some) -c -pipe -std=c++11 -o2 -arch x86_64 -xarch_x86_64 -mmacosx-version-min=10.5 -wall -w -dqt_use_qstringbuilder -dqt_no_debug -dqt_webkit_lib -dqt_xml_lib -dqt_gui_lib -dqt_network_lib -dqt_core_lib -dqt_shared
is normal? or there needs done on mac c++11 work?
it better include things explicitly , so, add code:
#include <cstddef>
if not work means have fundamental issue system, namely:
- you not use recent enough standard library implementation (e.g. try libc++).
- you not have c++11 , on compilation enabled.
as quick , nasty workaround, typedef of course, follows:
namespace std { typedef decltype(nullptr) nullptr_t; }
or without std
, ought last resort, , means doing wrong.
Comments
Post a Comment