I'm just learning c++ now, so the question might be stupid, but... I didn't find any information with search or google.
I'm using MS Visual C++ 6.0. I made a new class with "Insert - New class", and I try to specify the class features. For some reason I get 3 compiler errors when trying to compile the code:
c:\dir\test\test\car.h(16) : error C2146: syntax error : missing ';' before identifier 'itsName'
c:\dir\test\test\car.h(16) : error C2501: 'string' : missing storage-class or type specifiers
c:\dir\test\test\car.h(16) : error C2501: 'itsName' : missing storage-class or type specifiers
I cannot understand why a string is not recognized. Does anybody have any idea?
The actual code is here:
// car.h: interface for the car class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CAR_H__7D0E8056_D7F6_4086_A263_41FD17B8F1BB__INCLUDED_)
#define AFX_CAR_H__7D0E8056_D7F6_4086_A263_41FD17B8F1BB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class car
{
public:
car();
string itsName;
int itsDoors;
int itsCylinders;
int itsEnginesize;
char itsName;
virtual ~car();
};
#endif // !defined(AFX_CAR_H__7D0E8056_D7F6_4086_A263_41FD17B8F1BB__INCLUDED_)
I'm using MS Visual C++ 6.0. I made a new class with "Insert - New class", and I try to specify the class features. For some reason I get 3 compiler errors when trying to compile the code:
c:\dir\test\test\car.h(16) : error C2146: syntax error : missing ';' before identifier 'itsName'
c:\dir\test\test\car.h(16) : error C2501: 'string' : missing storage-class or type specifiers
c:\dir\test\test\car.h(16) : error C2501: 'itsName' : missing storage-class or type specifiers
I cannot understand why a string is not recognized. Does anybody have any idea?
The actual code is here:
// car.h: interface for the car class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CAR_H__7D0E8056_D7F6_4086_A263_41FD17B8F1BB__INCLUDED_)
#define AFX_CAR_H__7D0E8056_D7F6_4086_A263_41FD17B8F1BB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class car
{
public:
car();
string itsName;
int itsDoors;
int itsCylinders;
int itsEnginesize;
char itsName;
virtual ~car();
};
#endif // !defined(AFX_CAR_H__7D0E8056_D7F6_4086_A263_41FD17B8F1BB__INCLUDED_)