I know this may be a simple question, but I have been working on it for the past hour and a half, and I am really lost.
Here's the compiler error:
synthesized method 'File& File::operator=(const File&)' first required here
I have this bit of code:
void FileManager::InitManager() { int numberOfFile = Settings::GetSettings()->NumberOfFile() + 1; for( unsigned int i = 1; i < numberOfFile; i++ ) { std::string path = "data/data" ; path += i; path += ".ndb"; File tempFile( path ); _files.push_back( tempFile );
_files, if defined in this header:
#pragma once //C++ Header #include <vector> //C Header //local header #include "file.h" class FileManager { public: static FileManager* GetManager(); ~FileManager(); void LoadAllTitle(); private: FileManager(); static FileManager* _fileManager; std::vector<File> _files; };
A file is an object that I created, it is nothing more than a simple interface for working with an IO file. I have already done a vector of a custom object in the past, but this is the first time I get this error.
Here is the code for the File object: File.h
#pragma once //C++ Header #include <fstream> #include <vector> #include <string> //C Header //local header class File { public: File(); File( std::string path ); ~File(); std::string ReadTitle(); void ReadContent(); std::vector<std::string> GetContent(); private: std::ifstream _input; std::ofstream _output; char _IO; std::string _path; std::vector<std::string> _content; };
file.cpp
#include "file.h" File::File() : _path( "data/default.ndb" ) { } File::File( std::string path ) : _path( path ) { } File::~File() { } void File::ReadContent() { } std::string File::ReadTitle() { _input.open( _path.c_str() ); std::string title = ""; while( !_input.eof() ) { std::string buffer; getline( _input, buffer ); if( buffer.substr( 0, 5 ) == "title" ) { title = buffer.substr( 6 ); // 5 + 1 = 6... since we want to skip the '=' in the ndb } } _input.close(); return( title ); } std::vector<std::string> File::GetContent() { return( _content ); }
I work under linux with gcc.
Any hints or tips as to which solution can be appreciated.
Sorry for the long post.
thanks
source share