Since nobody done it and i really need (want) a central meeting point of all questions porting i start a thread here (yes, i know about OS4Porting and the IRC and some other sites, but i'm not going to register to any more sites, so...)
First question:
I'm trying to port (from scratch) a program (available for linux, windows, mac and android, so i guess pretty portable already) but am stuck with a compiler error which "seems" to be really easy to fix, but alas it's not.
This is the snippet from the file in question (src/dctypes.h, lines 31-40)
...
#include <string>
#include <list>
#include <vector>
using namespace std;
typedef std::string AnsiString;
typedef std::string Utf8String;
typedef std::wstring WideString;
...
and this is the error the compiler is throwing...obviously the mentioned "fix" doesn't comply as #include <string> is already in place
mkdir -p obj
g++ -c -o obj/AdActor.o ../src/AdActor.cpp -I../src -O2 -Wno-write-strings -Wno-conversion-null `freetype-config --cflags` `sdl2-config --cflags` -I/usr/local/include/bass/
In file included from ../src/PlatformSDL.h:31,
from ../src/dcgf.h:61,
from ../src/AdActor.cpp:26:
../src/dctypes.h:40:14: error: 'wstring' in namespace 'std' does not name a type
typedef std::wstring WideString;
^~~~~~~
../src/dctypes.h:40:9: note: 'std::wstring' is defined in header '<string>'; did you forget to '#include <string>'?
../src/dctypes.h:32:1:
+#include <string>
#include <string>
../src/dctypes.h:40:9:
typedef std::wstring WideString;
^~~
../src/dctypes.h:43:19: error: 'WideString' was not declared in this scope
typedef std::list<WideString> WideStringList;
^~~~~~~~~~
../src/dctypes.h:43:19: note: suggested alternative: 'Utf8String'
typedef std::list<WideString> WideStringList;
^~~~~~~~~~
Utf8String
../src/dctypes.h:43:29: error: template argument 1 is invalid
typedef std::list<WideString> WideStringList;
^
../src/dctypes.h:43:29: error: template argument 2 is invalid
../src/dctypes.h:46:21: error: 'WideString' was not declared in this scope
typedef std::vector<WideString> WideStringArray;
^~~~~~~~~~
../src/dctypes.h:46:21: note: suggested alternative: 'WideStringList'
typedef std::vector<WideString> WideStringArray;
^~~~~~~~~~
WideStringList
../src/dctypes.h:46:31: error: template argument 1 is invalid
typedef std::vector<WideString> WideStringArray;
^
../src/dctypes.h:46:31: error: template argument 2 is invalid
In file included from ../src/dcgf.h:171,
from ../src/AdActor.cpp:26:
../src/BFontTT.h:43:3: error: 'WideString' does not name a type; did you mean 'FT_String'?
WideString m_Text;
^~~~~~~~~~
FT_String
../src/BFontTT.h:98:18: error: 'WideString' does not name a type; did you mean 'FT_String'?
TextLine(const WideString& text, int width)
^~~~~~~~~~
FT_String
../src/BFontTT.h:104:9: error: 'WideString' does not name a type; did you mean 'FT_String'?
const WideString& GetText() const { return m_Text; }
^~~~~~~~~~
FT_String
../src/BFontTT.h:107:3: error: 'WideString' does not name a type; did you mean 'FT_String'?
WideString m_Text;
^~~~~~~~~~
FT_String
../src/BFontTT.h:139:21: error: 'WideString' does not name a type; did you mean 'FT_String'?
int WrapText(const WideString& text, int maxWidth, int maxHeight, TextLineList& lines);
^~~~~~~~~~
FT_String
../src/BFontTT.h:140:25: error: 'WideString' does not name a type; did you mean 'FT_String'?
void MeasureText(const WideString& text, int maxWidth, int maxHeight, int& textWidth, int& textHeight);
^~~~~~~~~~
FT_String
../src/BFontTT.h:142:27: error: 'WideString' does not name a type; did you mean 'FT_String'?
void PrepareGlyphs(const WideString& text);
^~~~~~~~~~
FT_String
../src/BFontTT.h:145:39: error: 'WideString' does not name a type; did you mean 'FT_String'?
CBSurface* RenderTextToTexture(const WideString& text, int width, TTextAlign align, int maxHeight, int& textOffset);
^~~~~~~~~~
FT_String
../src/BFontTT.h: In constructor 'CBFontTT::CBCachedTTFontText::CBCachedTTFontText()':
../src/BFontTT.h:55:4: error: 'm_Text' was not declared in this scope
m_Text = L"";
^~~~~~
../src/BFontTT.h:55:4: note: suggested alternative: 'm_Rect'
m_Text = L"";
^~~~~~
m_Rect
../src/BFontTT.h: In constructor 'CBFontTT::TextLine::TextLine(const int&, int)':
../src/BFontTT.h:100:4: error: 'm_Text' was not declared in this scope
m_Text = text;
^~~~~~
../src/BFontTT.h:100:4: note: suggested alternative: 'm_Rect'
m_Text = text;
^~~~~~
m_Rect
gmake: *** [obj/AdActor.o] Error 1
Is this one of those c++11 (or higher) errors (which are not or only partly supported yet) or do i need to adapt the source in one way or another?
Using gcc 8.1.0 here