[Interest] C++11 in Qt5

Stephen Chu stephen at ju-ju.com
Tue Jun 12 23:23:21 CEST 2012


On 6/12/12 5:12 PM, Thiago Macieira wrote:
> On terça-feira, 12 de junho de 2012 15.16.38, Stephen Chu wrote:
>> I am curious if the runtime issue on OS X has been dealt with?
>
> Yes. We decided not to force libc++. We're still using the compiler default,
> whichever that is (currently libstdc++). If the compiler changes defaults, you
> can blame the compiler vendor.
>
>> fatal error: 'initializer_list' file not found
>> #include <initializer_list>
>>            ^
>
> Our Mac developers have been using C++11 with libstdc++'s headers just fine.
> They've told me that Apple patches the libstdc++ headers to make them work.
>

Interesting. Can you ask them where the updated headers are for I can 
not get it to work without using libc++. I have both Xcode 4.3.3 and 
4.5DP installed and clang still insists including gcc 4.2.1 headers. 
This is the output from a simple code that uses initializer list:

stephen-chus-mac-pro:~ stephenchu$ clang++ -v -std=c++11 test.cpp
Apple clang version 4.0 (tags/Apple/clang-421.10.42) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
  "/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.7.0 -emit-obj 
-mrelax-all -disable-free -disable-llvm-verifier -main-file-name 
test.cpp -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose 
-munwind-tables -target-cpu core2 -target-linker-version 134.1 -v 
-resource-dir /usr/bin/../lib/clang/4.0 -fmodule-cache-path 
/var/folders/h5/v3v9_ng50wx5025tgx34rjtw0000gn/T/clang-module-cache 
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/stephenchu 
-ferror-limit 19 -fmessage-length 100 -stack-protector 1 -mstackrealign 
-fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak 
-fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties 
-fcxx-exceptions -fexceptions -fdiagnostics-show-option 
-fcolor-diagnostics -o 
/var/folders/h5/v3v9_ng50wx5025tgx34rjtw0000gn/T/test-HB8TU9.o -x c++ 
test.cpp
clang -cc1 version 4.0 based upon LLVM 3.1svn default target 
x86_64-apple-darwin11.4.0
ignoring nonexistent directory 
"/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
ignoring nonexistent directory "/usr/include/c++/4.0.0"
ignoring nonexistent directory "/usr/include/c++/4.0.0/i686-apple-darwin8/"
ignoring nonexistent directory "/usr/include/c++/4.0.0/backward"
#include "..." search starts here:
#include <...> search starts here:
  /usr/include/c++/4.2.1
  /usr/include/c++/4.2.1/backward
  /usr/local/include
  /usr/bin/../lib/clang/4.0/include
  /usr/include
  /System/Library/Frameworks (framework directory)
  /Library/Frameworks (framework directory)
End of search list.
test.cpp:8:14: error: no matching constructor for initialization of 
'vector<int>'
         vector<int> a {0,2,4};
                     ^ ~~~~~~~
/usr/include/c++/4.2.1/bits/stl_vector.h:255:9: note: candidate constructor
       [with _InputIterator = int] not viable: no known conversion from 
'int' to
       'const allocator_type' (aka 'const std::allocator<int>') for 3rd 
argument;
         vector(_InputIterator __first, _InputIterator __last,
         ^
/usr/include/c++/4.2.1/bits/stl_vector.h:213:7: note: candidate 
constructor not viable: no known
       conversion from 'int' to 'const allocator_type' (aka 'const 
std::allocator<int>') for 3rd
       argument;
       vector(size_type __n, const value_type& __value = value_type(),
       ^
/usr/include/c++/4.2.1/bits/stl_vector.h:201:7: note: candidate 
constructor not viable: requires at
       most 1 argument, but 3 were provided
       vector(const allocator_type& __a = allocator_type())
       ^
/usr/include/c++/4.2.1/bits/stl_vector.h:231:7: note: candidate 
constructor not viable: requires 1
       argument, but 3 were provided
       vector(const vector& __x)
       ^
1 error generated.
stephen-chus-mac-pro:~ stephenchu$



More information about the Interest mailing list