Need some help with errors, culmination of a File System Project [closed]

我们两清 提交于 2019-12-14 03:28:02

问题


class BufferFile{
public:
BufferFile(IOBuffer &);
int Open(char *);
int Create(char *);
int Close();
int Rewind();
int Read(int recaddr = -1);
int Write(int recaddr = -1);
int Append();
IOBuffer & GetBuffer();
protected:
IOBuffer & Buffer;
std::fstream File;
int HeaderSize;
int ReadHeader();
int WriteHeader();
};

BufferFile::BufferFile(IOBuffer & from):Buffer(from){}    

int BufferFile::Read(int recaddr){  
    if(recaddr==1) return Buffer.Write(File);  
    else return Buffer.DWrite(File, recaddr);  
}  

int BufferFile::Append(){  
    File.seekp(0,std::ios::end);  
    return Buffer.Write(File);  
}  

IOBuffer & BufferFile::GetBuffer(){  
    return Buffer;  
}  

int BufferFile::ReadHeader(){  
    return Buffer.ReadHeader(File);  
}  

int BufferFile::WriteHeader(){  
    return Buffer.WriteHeader(File);  
}  

I am getting several errors form the IOBuffer field, saying that it was not declared in the function scopes or "expected `)' before ‘&’ token" on the constructor.

Any help is appreciated


回答1:


Several of the errors mention that class IOBuffer has no member named "pack". The message is absolutely correct, it doesn't; if you look at the header, it has a method named Pack, with a capital P. C++ is case-sensitive!

The errors about "redefinition" are happening because your include files don't have include guards to prevent them from being included multiple times -- you need to fix that.

That leaves only a few errors remaining; when you've got everything down to those last few, come back and talk to us again. This time, no images! No links! Just paste the actual text of the error message, and the few lines of code where the errors occur, and somebody will be able to help you.



来源:https://stackoverflow.com/questions/6092879/need-some-help-with-errors-culmination-of-a-file-system-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!