G
Guest
I've been unusually plagued by programs compiling flawlessly but
aborting halfway through due to SIGABRT error 6. I've done my best to
diagnose, but it's not clear what I'm looking for; the code causing can
be boiled down to basic commands. Below is the simplest instance I've
made that reproduces the problem.
Assume a class A. Class A contains a void function called insert:
// file A.h
#include <string>
class A {
public:
void insert (string y1, string y2, string y3, string y4);
};
// file A.cpp
void insert (string y1, string y2, string y3, string y4) {
return;
}
// main.cpp
#include <fstream>
#include <string>
int main (int argc, char * const argv[]) {
// VARIABLES -----------------------------
ifstream inFile ("InSymbols.txt"); // Program
assumes InSymbols.txt exists in program dir
string x1, x2, x3, x4;
A myA;
if (inFile.is_open ()) {
while (!inFile.eof ()) { // read
each word separately
inFile >> x1;
inFile >> x2;
inFile >> x3;
inFile >> x4;
myA.insert (x1, x2, x3, x4);
}
}
else
cout << "Error opening file!\n";
inSymbols.close (); //
close file stream
return 0;
}
// end code
Debugging has shown x1 --> x4 to have been given the string values I
expected. However, the second myA.insert() is called, the error signal
occurs:
ZeroLink: unknown symbol '__ZN11A6insertESsSsSsSs'
I'm baffled. Thank you so much!
Will
aborting halfway through due to SIGABRT error 6. I've done my best to
diagnose, but it's not clear what I'm looking for; the code causing can
be boiled down to basic commands. Below is the simplest instance I've
made that reproduces the problem.
Assume a class A. Class A contains a void function called insert:
// file A.h
#include <string>
class A {
public:
void insert (string y1, string y2, string y3, string y4);
};
// file A.cpp
void insert (string y1, string y2, string y3, string y4) {
return;
}
// main.cpp
#include <fstream>
#include <string>
int main (int argc, char * const argv[]) {
// VARIABLES -----------------------------
ifstream inFile ("InSymbols.txt"); // Program
assumes InSymbols.txt exists in program dir
string x1, x2, x3, x4;
A myA;
if (inFile.is_open ()) {
while (!inFile.eof ()) { // read
each word separately
inFile >> x1;
inFile >> x2;
inFile >> x3;
inFile >> x4;
myA.insert (x1, x2, x3, x4);
}
}
else
cout << "Error opening file!\n";
inSymbols.close (); //
close file stream
return 0;
}
// end code
Debugging has shown x1 --> x4 to have been given the string values I
expected. However, the second myA.insert() is called, the error signal
occurs:
ZeroLink: unknown symbol '__ZN11A6insertESsSsSsSs'
I'm baffled. Thank you so much!
Will