Problems with using C++11 / <tr1/memory> not found

Hey all,

I’m running OSX 10.10 and have the latest version of openFrameworks (v0.9.0) on my computer, and am trying to add an addon that requires C++11. I’ve tried changing Xcode’s build settings to use the C++11 dialect and libc++, but this gives the error tr1/memory file not found in ofMain.h and ofTypes.h.

I tried a number of the fixes mentioned on github (see: https://github.com/openframeworks/openFrameworks/pull/2764), but with OSX 10.10 and Xcode 6.1.1, I don’t have the option to build in any base SDK lower than 10.9 (which doesn’t compile).

I suppose I can try reverting back to an older version of Xcode, but I didn’t know if there was a branch of openframeworks that was C++11-ready?

thanks!

There is a branch ready for C++11 + 64 bit. I haven’t personally given it a thorough test but it does seem to work. You’ll need to recompile all of the OF core libs (note the “Prerequisites” instructions in the PR). The apothecary script can be found in openFrameworks/scripts/apothecary

https://github.com/openframeworks/openFrameworks/pull/3627

Thanks! I’ll check this out and see if I can get it rolling :slight_smile:

I’m a bit uncertain how to pull this – is there an oF branch that I can just rebuild with the apothecary script, or do I need to pull a version from tgfrerer:of_64_bit_c++11? I’m having trouble tracking exactly what’s going on in the pull request.

Github will give you some command line arguments you can copy-paste to check out tgfrerer’s branch. It’s at the bottom of the pull request. Run them from inside the OF repo.

git checkout -b tgfrerer-of_64_bit_c++11 master
git pull https://github.com/tgfrerer/openFrameworks.git of_64_bit_c++11

After that, you need to run the apothecary update commands mentioned in the PR, under Pre-Requisites. Run them from in the openFrameworks/scripts/apothecary folder

I’m currently running oF in 64bits C++14 in Mac Os X 10.10 from the master branch. All I did was run the apothecary update , change the project configurations from both openFrameworks and my project and then changing one line of code in ofTypes.h to include #define(TARGET_OSX)
so

#if (_MSC_VER) || ((defined(TARGET_EMSCRIPTEN) ||  defined(TARGET_LINUX) || defined(TARGET_ANDROID)) && __cplusplus>=201103L)

became

#if (_MSC_VER) || ((defined(TARGET_EMSCRIPTEN) || defined(TARGET_OSX) || defined(TARGET_LINUX) || defined(TARGET_ANDROID)) && __cplusplus>=201103L)

@admsyn do you know if there’s a reason for this #if to not include Os X?

Not sure! Might be worth mentioning that in the PR

Are you talking about the PR I made recently? I made that PR by accident and tried to cancel it later as it didn’t follow the workflow guidelines.
I’m not used to git so I constantly screw up things when using it…

Ah, I was referring to tgfrerer’s PR above (assuming that’s what you’re using?)

No, I’m on Master! The only downside of updating the apothecaries is that I can no longer come back to C++98 32bits (I think RtAudio is the problem), but that’s fine for me. C++14 <3
I saw tgfrefer’s PR and that line is corrected in there

1 Like