I've been trying my best to solve a little problem I have but am struggling to find a sensible solution/explanation so I was hoping someone could help?
I have basically created a function which, inside, writes to a file, and I was hoping that outside of this I would be able to open that said file but I get the following error:
Undefined symbol: ReadingAFile(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)
My codes are as follows:
Function:
void CreatingAFile(int n)
{
matrix_Struct matrix_A;
matrix_A.value = n;
matrix_A.symmetric = 1;
std::ofstream writeFile;
writeFile.open("fileToOpen.dat");
assert(writeFile.is_open());
writeFile << "Symmetry" << "\n";
writeFile << matrix_A.symmetric << "\n";
writeFile << "Number to Iterate";
writeFile << matrix_A.value << "\n";
}
My main:
int main()
{
CreatingAFile(3);
csr_matrix file3 = ReadingAFile("fileToOpen.dat");
}
where ReadingAFile is a file from another header of mine, that runs perfectly fine - it has a function prototype:
matrix_Struct ReadingAFile(std::string nameOfFile);