I’m trying to compile the files exactly as given but I get the following errors:
||=== Build: Debug in test2.0proj (compiler: GNU GCC Compiler) ===|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp||In function ‘bool loadMedia()’
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|378|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|378|error: ‘_Longlong’ was not declared in this scope|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|381|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|381|error: expected ‘)’ before ‘gData’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp||In function ‘int SDL_main(int, char**)’
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|479|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|479|error: ‘_Longlong’ was not declared in this scope|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|487|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|487|error: expected ‘)’ before ‘gData’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|493|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|493|error: expected ‘)’ before ‘gData’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|501|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|501|error: expected ‘)’ before ‘gData’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|507|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|507|error: expected ‘)’ before ‘gData’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|513|error: ‘to_string’ is not a member of ‘std’|
C:\game dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|513|error: expected ‘)’ before ‘gData’|
||=== Build failed: 16 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
In particular, “to_string is not a member of std” is concerning me. I googled it and it says that this is a problem with mingw but I’m using the most recent version of code::blocks which should therefore have the most recent mingw. What could I do to make this work?
dont be just copying and pasting demos and tutorials from the internet,
read about SDL, c++ and its libraries.
and if you are going to use a tutorial, a tip: write everyline of code of
the tutorial on your own. that way at least you have some kind of sense of
what the program is doing.
also be sure you have
#include
2014-03-16 0:56 GMT-07:00 shinn497 :> I’m trying to compile the files exactly as given but I get the following
errors:
||=== Build: Debug in test2.0proj (compiler: GNU GCC Compiler) ===|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp||In
function ‘bool loadMedia()’[image: Neutral]
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|378|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|378|error:
‘_Longlong’ was not declared in this scope|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|381|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|381|error:
expected ‘)’ before ‘gData’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp||In
function ‘int SDL_main(int, char**)’[image: Neutral]
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|479|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|479|error:
‘_Longlong’ was not declared in this scope|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|487|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|487|error:
expected ‘)’ before ‘gData’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|493|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|493|error:
expected ‘)’ before ‘gData’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|501|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|501|error:
expected ‘)’ before ‘gData’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|507|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|507|error:
expected ‘)’ before ‘gData’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|513|error:
‘to_string’ is not a member of ‘std’|
C:\game
dev\33_file_reading_and_writing\33_file_reading_and_writing\33_file_reading_and_writing.cpp|513|error:
expected ‘)’ before ‘gData’|
||=== Build failed: 16 error(s), 0 warning(s) (0 minute(s), 0 second(s))
===|
In particular, “to_string is not a member of std” is concerning me. I
googled it and it says that this is a problem with mingw but I’m using the
most recent version of code::blocks which should therefore have the most
recent mingw. What could I do to make this work?
std::to_string() also happens to be a C++11 feature. You have to turn on
C++11 support explicitly for your compiler. Use the compiler flag
-std=c++11 or -std=gnu++11.