g++ -std=c++11 -c test.cpp
g++ -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -o test test.o
cmake -D CMAKE_CXX_COMPILER=$(which g++) -D CMAKE_C_COMPILER=$(which gcc) -D CMAKE_CXX_FLAGS="-std=c++11" -D CMAKE_C_FLAGS="-std=c++11" -D CMAKE_OSX_ARCHITECTURES="x86_64" .
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/g++
-- Check for working CXX compiler: /usr/local/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Found Freetype: /Users/cdelorme/Documents/packages/tmp/SFML-2.1/extlibs/libs-osx/Frameworks/freetype.framework (found version "2.4.11")
-- Found GLEW: /Users/cdelorme/Documents/packages/tmp/SFML-2.1/extlibs/libs-osx/lib/libGLEW.a
-- Found JPEG: /Users/cdelorme/Documents/packages/tmp/SFML-2.1/extlibs/libs-osx/lib/libjpeg.a
-- Found OpenAL: /System/Library/Frameworks/OpenAL.framework
-- Found SNDFILE: /Users/cdelorme/Documents/packages/tmp/SFML-2.1/extlibs/libs-osx/Frameworks/sndfile.framework
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/cdelorme/Documents/packages/tmp/SFML-2.1
make
[ 1%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.o
[ 2%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Err.cpp.o
[ 3%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Lock.cpp.o
[ 4%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Mutex.cpp.o
[ 5%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Sleep.cpp.o
[ 6%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/String.cpp.o
[ 7%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Thread.cpp.o
[ 9%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/ThreadLocal.cpp.o
[ 10%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Time.cpp.o
[ 11%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ClockImpl.cpp.o
[ 12%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/MutexImpl.cpp.o
[ 13%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/SleepImpl.cpp.o
[ 14%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ThreadImpl.cpp.o
[ 15%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ThreadLocalImpl.cpp.o
Linking CXX shared library ../../../lib/libsfml-system.dylib
[ 15%] Built target sfml-system
[ 17%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Context.cpp.o
[ 18%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.cpp.o
[ 19%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlResource.cpp.o
[ 20%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Joystick.cpp.o
[ 21%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/JoystickManager.cpp.o
[ 22%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Keyboard.cpp.o
[ 23%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Mouse.cpp.o
[ 25%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/VideoMode.cpp.o
[ 26%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Window.cpp.o
[ 27%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/WindowImpl.cpp.o
[ 28%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/cpp_objc_conversion.mm.o
[ 29%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/cg_sf_conversion.cpp.o
[ 30%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/InputImpl.mm.o
/Users/cdelorme/Documents/packages/tmp/SFML-2.1/src/SFML/Window/OSX/InputImpl.mm: In function 'SFOpenGLView* sf::priv::getSFOpenGLViewFromSFMLWindow(const sf::Window&)':
/Users/cdelorme/Documents/packages/tmp/SFML-2.1/src/SFML/Window/OSX/InputImpl.mm:79:30: error: expected ';' before 'in'
for (NSView* subview in subviews) {
^
/Users/cdelorme/Documents/packages/tmp/SFML-2.1/src/SFML/Window/OSX/InputImpl.mm:79:30: error: 'in' was not declared in this scope
/Users/cdelorme/Documents/packages/tmp/SFML-2.1/src/SFML/Window/OSX/InputImpl.mm:79:33: error: expected ';' before 'subviews'
for (NSView* subview in subviews) {
^
make[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/OSX/InputImpl.mm.o] Error 1
make[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [all] Error 2
cmake -D CMAKE_CXX_FLAGS="-stdlib=libc++" -D CMAKE_C_FLAGS="-stdlib=libc++ -D_GLIBCXX_FULLY_DYNAMIC_STRING=1" -D CMAKE_OSX_ARCHITECTURES="x86_64" .
So building it is unsuccessful, and I'm pretty sure this is an entirely unrelated problem.Well, apparently GCC is not able to understand that .mm files are Objective-C++ code. Maybe have a look on the web to find out if it's a known issue or not. I can't help you.
a bug in the apple clang compilerThe bug is not in clang or gcc! It's libstdc++'s fault. You can try updating libstdc++ on your system if you want but you are definitely going to have huge issue with your users when distribution your app...
was able to compile with this command, leaving clang but setting the `-D_GLIBCXX_FULLY_DYNAMIC_STRING=1` flag:You're defining _GLIBCXX_FULLY_DYNAMIC_STRING but at the same time you're using clang + libc++. That's useless.
I do not understand why anyone would refuse to patch it.Ask Apple's dev team. It's a bug on their side. If SFML were to patch every bug to work with any combination of OS, compiler, driver, ... we would end up with a HUGE mess.
and I haven't seen a logical reason like:
- It's a difficult bug that extends beyond the `sf::String` class.
- A patch could introduce erratic behavior or slow performance.
I just do not follow the logic behind the "It's not my fault" reasoning of the discussion around this issue.I think I already answered this a few line above. But take my place (or the place of any SFML team member) for a sec'. You have limited time resources and more importantly you have to think about long term development. Fixing corner case like this one when it's not SFML fault is a no-go for code maintenance and stability (e.g. performance).
If not a code patch, how about a comment in the `sf::String` documentation so that developers are made aware of the problem?It would be overkill and defeat the purpose of the doc to add a comment for each problem like this one: you'll end up with a huge documentation text that barely talks about how to use SFML and its features. Instead, the bug tracker is more appropriate.
Undefined symbols for architecture x86_64:
"sf::String::String(char const*, std::locale const&)", referenced from:
_main in 42.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
./compile: line 82: ./42: No such file or directory