SFML community forums
Help => General => Topic started by: The Terminator on January 28, 2013, 07:45:12 pm
-
Hi there, I've finally been able to link SFML 2.0 on my macbook pro. I'm trying to load my code that I've written on my Windows machine, but it seems that Xcode doesn't like std::unique_ptr. In fact, that's the only thing that Xcode is reporting as wrong.
My specs:
OS X 10.8.2
Macbook Pro
Xcode 4.5.2
Is there a bug or something with SFML? I can use std::unique_ptr on regular console applications. My code runs fine on my windows machine. Help is greatly appreciated.
Thanks
-
Have you set the compiler flag -std=c++11 and included <memory>?
What's the version of your compiler? (No Xcode is not a compiler, it's an IDE) ;)
-
Have you set the compiler flag -c++11
For both clang and g++, the flag is -std=c++11 (or -std=c++0x in older versions).
-
For both clang and g++, the flag is -std=c++11 (or -std=c++0x in older versions).
That's what I've meant, thx. ;D
-
To complement eXpl0it3r and Nexus here is the automatized way :
If you're using the lastest templates for Xcode (some details here (http://en.sfml-dev.org/forums/index.php?topic=10394.msg71564#msg71564)), you can enable C++11 support easily. Choose «C++11 with Clang and libc++».
But remember : you need a compatible version of SFML. That is, you need to compile SFML with libc++ instead of libstdc++.
Read $C++11 here : http://www.sfml-dev.org/tutorials/2.0/start-osx.php
and Cmake tutorial here : http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php
-
So there's no way to use c++11 with templates? I don't like cmake and it's given me a lot of trouble in the past.
-
Yes, there is. Maybe my previous sentence was not clear.
So to rephrase If you're using the lastest templates for Xcode (some details here), you can enable C++11 support easily. Choose «C++11 with Clang and libc++».
When you create a new project with the latest templates for SFML, you can select a few options. To use C++11 in your project, select «C++11 with Clang and libc++» for «C++ Compiler and Standard Library». (Or, of course, you can change the settings of your current project to use clang and libc++.)
Regarding cmake, you should give it a try. It's not so difficult. ;-)
Here (http://en.sfml-dev.org/forums/index.php?topic=10400.msg71632#msg71632) you can find the set of command that you'll need.