I have a major issue that is blocking development.
The game I am working on use an archive system for handling assets based on stream operators.
This code works perfectly on Windows and Linux but fails on Mac.
Originally the code had a single string streamer...
Archive& operator <<(Archive& ar, std::string& val)
When I tried to link the game I got the error
Undefined symbol: ge::operator<<(ge::Archive&, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator >)
I checked around and other people had had this issue.They all swapped from libc++ to libstdc++. I cannot do that
So I added ...
Archive& operator <<(Archive &ar, std::basic_string<char,std::char_traits,std::allocator>val)
Just to get it to link, hoping the runtime code would perform as expected.
It doesn't.
The basic_string version is the method that is called and the problem with that is it creates a new string instead of writing to the supplied string.
So you cannot load any strings.
I also have had problems with templates.
template<> TMap<std::string, soundbuffer=""> UrlResourceCache::map;
Won't link. I had to do ...
template<typename T> TMap<std::string, T*> UrlResourceCache<T>::map;
I am finding it harder and harder to work in c++ on Mac
Has anyone come up with a solution for the archive issue?
Well actually it does work.
I eventually found the problem was that one of the games libraries, when I added it to the game project, changed include paths for the core library. This library contains all the archive handling.
So some of the code was including the correct version of core, some was looking at the unconverted (win32) version.
When I corrected the include path and removed the basic_string version of the serialiser, everything worked.
However the bug in libc++ remains. Taking a copy of a string before serialisation is a very bad idea for lot's of reasons.
I don't care now though as I have working code and can progress. I would love to know why xcode changed include paths though, that's a weird one.