I'm trying to compile yaml-cpp on windows 10. For some reason, atoi is not part of the std namespace and I can't figure out what is wrong. Thanks!
cmake -G "MinGW Makefiles"
... (Makefile gets generated)
mingw32-make
C:\yaml-cpp-master\util\read.cpp: In function 'int main(int, char**)':
C:\yaml-cpp-master\util\read.cpp:54:11: error: 'atoi' is not a member of 'std'
N = std::atoi(argv[i]);
^
util\CMakeFiles\read.dir\build.make:62: recipe for target 'util/CMakeFiles/read.dir/read.cpp.obj' failed
You have two options of including atoi():
#include <stdlib.h>
, which is more C friendly and is referred to as simply atoi()
.#include <cstdlib>
, which is more C++ friendly and can be referred to both atoi()
and std::atoi()
.