i understand that this error means that there are hiden errors that have not bin located, I'm just having a hard time fingering out were those errors are. please give me some pointers on how to find the unknown error.
over the " ld returned 1 exit status " error are these two errors
undefined reference to `MyList::count'
bad reloc address 0x1 in section.text$_ZStorSt13_Ios_OpenmodeS_[_ZStorSt13_Ios_OpenmodeS_]
my progect consists of
getData()
to read info form a txtsortData()
to sort the infosaveData()
to save the info in a txt
here is the class and the program
#include <iostream>
#include <fstream>
using namespace std;
class MyList{
private:
int info2[100][2], info[100][2];
int count = 0;
public:
void getData(string);
void saveData(string);
void sortData();
};
void MyList::getData(string a){
int i;
ifstream file;
file.open(a.c_str());
if(!file.is_open()){
cout << " File did not open, can not read" <<endl;
return;
}
for(i=0; ;i++){
file >> info[i][0] >> info[i][1];
if(file.eof()){
break;
}
}
count=i;
file.close();
}
void MyList::sortData(){
ifstream file;
int i,a,b,c,flag=1;
int j=0;
for(i=0;i<count;i++){
for(i=0;(i<=count-1) && flag;i++){
if(info[i][a] < info[i+1][a]){
info2[b][c] = info[i][a];
info[i][a] = info[i+1][a];
info[i+1][a] = info2[b][c];
flag = 1;
}
}
}
}
void MyList::saveData(string a){
int i;
ofstream file(a.c_str());
if(!file.is_open()){
cout << " File did not open, can not save" <<endl;
return;
}
for(i=0;i>=count;i++){
file << info[i][0] << info[i][1];
}
}
#include <iostream>
#include "aList.h"
using namespace std;
here's the project that is giving the error
int main(){
MyList obj;
string fileName;
cout << " what is your files name? :";
cin >>fileName;
obj.getData(fileName);
obj.sortData();
obj.saveData(fileName);
return 0;
}