Lỗi "string has not been declared" trong file header tự tạo

#ifndef OBJECT_H_INCLUDED
#define OBJECT_H_INCLUDED

#include <SDL.h>
#include <SDL_image.h>
#include <cstring>
using namespace std;


class OBject
{
private:
    SDL_Rect dest;
    SDL_Rect src;
    SDL_Texture* Tex;
public:
    OBject() {}
    SDL_Rect getDest() const {return dest;}
    SDL_Rect getSource() const {return src;}
    void setDest(int x, int y, int w, int h);
    void setSource(int x, int y, int w, int h);
    void SetImage(string path, SDL_Renderer* ren);
};

#endif // OBJECT_H_INCLUDED

e viết một file header như vậy mặc dù đã khái báo using namespace std nhưng biên dịch vẫn báo lỗi declared là sao mn ơi huhu giúp e vs

Nhưng chưa #include <string>.

2 Likes

e đã thử và cả #include cstring cũng bị lỗi y nguyên ạ

<string> khác <cstring> nha em

3 Likes

e xin cam on e fix dc r

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?