C++ C++;-‘_itoa&x2019;未在此范围中声明

C++ C++;-‘_itoa&x2019;未在此范围中声明,c++,C++,在UserProfile.h中,我声明了类UserProfile #include <iostream> #include <map> #include <string> using namespace std; class UserProfile { ... } 但我已经包括了“cstdlib”。。。真奇怪 另外,当我想使用时,函数的正确名称是itoa而不是\u itoa。但是,它不能用于C++。cplusplus.com说: 这个函数在ANSI

在UserProfile.h中,我声明了类UserProfile

#include <iostream>
#include <map>
#include <string>

using namespace std;

class UserProfile
{
   ...
}
但我已经包括了“cstdlib”。。。真奇怪


另外,当我想使用时,函数的正确名称是itoa而不是\u itoa。但是,它不能用于C++。cplusplus.com说:

这个函数在ANSI-C中没有定义,不是C++的一部分,但有些编译器支持。 相反,使用std::检查字符串或字符串流


至于关于运算符的编译时错误,谢谢!在UserProfile.h中添加声明后,以下问题operator@ATlaS编辑答案。
#include "UserProfile.h"
#include <cstdlib>

inline UserProfile::UserProfile()
    : _login("guest"), _user_level(Beginner),
      _times_logged(1), _guesses(0), _correct_guesses(0)
{
    static int id = 0;
    char buffer[16];

    _itoa(id++, buffer, 10);
    _login += buffer;
}
...
ostream& operator<<(ostream &os, const UserProfile &rhs)
{
    os << rhs.login() << ' '
       << rhs.level() << ' '
       << rhs.login_count() << ' '
       << rhs.guess_count() << ' '
       << rhs.guess_correct() << ' '
       << rhs.guess_average() << endl;
    return os;
}
g++ UserProfile.cpp E44.cpp -o main
UserProfile.cpp: In constructor ‘UserProfile::UserProfile()’:
UserProfile.cpp:11:27: error: ‘_itoa’ was not declared in this scope
     _itoa(id++, buffer, 10);
#include "UserProfile.h"

int main()
{
    UserProfile anon;
    cout << anon;
    ...
}
E44.cpp: In function ‘int main()’:


E44.cpp:6:10: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘UserProfile’)
    cout << anon;
ostream& operator<<(ostream &os, const UserProfile &rhs);
class UserProfile
{
    friend ostream& operator<<(ostream &os, const UserProfile &rhs);
};