From the use of backslashes in your path I am guessing you're on Windows, and from the fact it does not work, I am guessing you're using a very old distribution of mingw. Try a modern one from https://nuwen.net/mingw.html or http://mingw-w64.org or just use Visual Studio (it's also free, and is native to your platform)
If you use the Code::Blocks IDE, you have to overwrite your three header files before using these functions. Try this http://tehsausage.com/mingw-to-string
Surely there is some solution that doesn't require such a seismic shift for such a small problem. : )
If your compiler doesn't support stoX() then there is always the always available stringstream approach to convert to strings.
I believe the stoX() functions require a 5.0 or higher version of the g++ compiler and if your compiler doesn't support this function then you will need to either upgrade the compiler or find a compiler that does support this feature.
#include <sstream>
#include <stdexcept>
float get_float(std::string& message)
{
std::stringstream ss(message);
float value;
ss >> value;
if (!ss)
throw std::invalid_argument(message);
//TODO check for ot of range error
return value;
}
Alternativ you can use the good old atof, though it returns a double
getting an error with the version type algorithm above.
..\src\main.cpp:21:39: error: '_GLIBCXX_RELEASE' was not declared in this scope
<< "libstdc++: " << _GLIBCXX_RELEASE << " (release date " << __GLIBCXX__ << ")\n" ;
I'll continue to work on that and with the other comments.
Well, I'm back! I've installed MingW64 as per above and have been compiling 64bit programs for a while now. Very cool. The successful compiler change didn't fix the pesky atof error though:
error
1 2 3
..\src\main.cpp: In function 'void readObj(std::__cxx11::string)':
..\src\main.cpp:569:87: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'for argument '1' to 'double atof(const char*)'
vertex.x = std::atof(dataLine.substr(foundStart, foundEnd - foundStart));
You're trying to feed a C++ string to the C function atof. It's either std::stof(dataLine.substr(foundStart, foundEnd - foundStart)); or std::atof(dataLine.substr(foundStart, foundEnd - foundStart).c_str());