This code :

...line 6...

#include "FileToVector.h"
#include "VectorToIntArray.h"
#include <string.h>
#include <iostream>

using namespace std;

int main(int argc, char *argv[]){
	char* in = argv[1];
	FileToVector ftv = FileToVector(in);
	vector<char> v = ftv.fileToVector();
	VectorToIntArray vt = VectorToIntArray(v);
	//int* a = vt.letterFrequencies();
	cout<< v.size();
	return 0;
}

produces this error :
../FileToExecute.cpp: In function ‘int main(int, char**)’:
../FileToExecute.cpp:17: note: synthesized method ‘FileToVector::FileToVector(const FileToVector&)’ first required here
make: *** [FileToExecute.o] Error 1


there is also this class:

class FileToVector {
private:
	fstream file;
	char* filename;
public:
	FileToVector( char* filenameIn){
		//for ( unsigned int i = 0; i < filenameIn.i; i ++){
			filename = filenameIn;
		//}
		//filename[filenameIn.length()] = '\0';
	}
	vector<char> fileToVector(){
		char ch;
		vector<char> fileVector;
		file.open(filename, ios::in);
		while( (ch = file.get()) != EOF){
			if ( ch != ' ' && ch != '\n'){
				fileVector.push_back(ch);
			}
		}
		file.close();
		return fileVector;
	}
};

and another one, which does not affect things...
Any ideas?

int main(int argc, char *argv[]){
    char* in = argv[1];
    FileToVector ftv = FileToVector(in);   // line of error..!!!!!!!!!!!!11
    vector<char> v = ftv.fileToVector();
    VectorToIntArray vt = VectorToIntArray(v);
    //int* a = vt.letterFrequencies();
    cout<< v.size();
    return 0;
}

compilation error:

../FileToExecute.cpp:17: note: synthesized method ‘FileToVector::FileToVector(const FileToVector&)’ first required here 
make: *** [FileToExecute.o] Error 1

Any clues?

The error that you are getting is complaining that there is no definition of a copy constructor. Yet normally this is created without you explicitly requiring it.

If I remember right your error is down to using fstream as a member variable I don't think that it is an object which can be copied and therefore the = on line 6 is your problem

the fix is not to have file as a member variable. Instead use a local variable in your FileToVector.cpp and then it should be ok

The error that you are getting is complaining that there is no definition of a copy constructor. Yet normally this is created without you explicitly requiring it.

If I remember right your error is down to using fstream as a member variable I don't think that it is an object which can be copied and therefore the = on line 6 is your problem

the fix is not to have file as a member variable. Instead use a local variable in your FileToVector.cpp and then it should be ok

Solved...thank you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.