C++ классы // помогите пожалуйста разобратся
Что не так ...вроде всё верно(
============================= \ main.h \/
#include "main.h"
int main()
{
mainn.coutt("test");
}
void mainclass::coutt(string _in)
{
cout << _in << '\x20';
}
============================= \ main.h\/
#ifndef _MAIN_H_
#define _MAIN_H_
#include <cstring>
#include <iostream>
class mainclass
{
public:
void coutt(string _in);
}mainn;
#endif // _MAIN_H_
ругается \/
o04@ta4ila:~/prg/consolle/gaga$ g++ main.cpp -o out
In file included from main.cpp:1:
main.h:28: error: ‘string’ has not been declared
main.cpp: In function ‘int main()’:
main.cpp:5: error: invalid conversion from ‘const char*’ to ‘int’
main.cpp:5: error: initializing argument 1 of ‘void mainclass::coutt(int)’
main.cpp: At global scope:
main.cpp:8: error: variable or field ‘coutt’ declared void
main.cpp:8: error: ‘string’ was not declared in this scope
что как бы string невозможно заюзать внутри класса?(
в чём ошибка или какие могут быть альтенативы?
вопросс не актуальный! ! .трабла была из за того что => савсем забыл о пространстве имён) )
\/
using namespace std;
or
std::string
std::cout
.