hey guys
was keen to try some c++11 features so tried to compile with:
-xcode 4.2.1
-llvm 3.0
-deployment target OSX 10.7
-base SDK OSX 10.7

but I get an include error in ofTypes.h, line 9:
#include <tr1/memory>
‘tr1/memory’ file not found

shared pointers should be standard in llvm somewhere but maybe there should be an ifdef to catch the compiler and change the include to something else? anyone had any luck with this?

yes in c++11 tr1 dissappears and everything in that folder becomes standard and goes directly in include, so that include should be:

#include <memory>  

there is a way of querying the c++ version and use an ifdef to include one or another but don’t remember the exact definition, if you find it please post so i can fix the code

There is a way, but it’s neither foolproof nor complete (for OF’s cross-platform/cross-compiler use). Still, I think this is what you mean arturo:

maybe until the macro is better supported we can just add our own to test for to the project settings like ‘OF_CPP11’ or something?

I tried to compile again, changed the include to
and std::try::shared_ptr to std::shared_ptr
but then I get some other errors for ofPtr in ofTypes.h:

Unknown template name 'shared_ptr'  

strange as the code completion can find std::shared_ptr<>
have tinkered for a bit but afraid this is one is over my head - initial googlings make this look like possibly a clang bug that should have been resolved by now.

anyone else have better luck?

hey just in case someone stumbles across this thread who didn’t know this either. if you set the compiler to llvm 3.0 and change the c++ dialect to support c++0x then you can start using c++11 features even if not using OSX 10.7 and libc++.

that’s enough for me for now, at least until llvm supports lambdas!

check this github issue for more on xcode+oF+C11