식별자 "string"이 (가) 정의되지 않았습니다.식별자 "string"이 정의되지 않았습니까?
그러나 string.h를 포함하고 있으며 내 주 파일에 모든 것이 잘 작동합니다.
코드 :이 발생하는 이유
#pragma once
#include <iostream>
#include <time.h>
#include <string.h>
class difficulty
{
private:
int lives;
string level;
public:
difficulty(void);
~difficulty(void);
void setLives(int newLives);
int getLives();
void setLevel(string newLevel);
string getLevel();
};
누군가가 나에게 설명해 주시겠습니까?
쓰기 귀하의 코드입니다. 컴파일러가'#pragma once' 지시어로 더 잘한다면,'#ifndef XXX_HEADER // #define XXX_HEADER // #pragma once // ... // #endif'와 같이 순서가 중요하다면 (예 : include 프래그머를 감싸는 가드) –