I have a large amount of code, so I have tried to only include the relevant parts of the code here
I have a header file called "ASp.h"
namespace ASP
{
class ASp
{
public:
ASp();
ASp(FILE* fp);
void T_B_P_N(const char* type, int num);
}
}
another header file "ms.h"
bool aSpQ(int argc, char* argv[]);
a cpp file "ms.cpp"
bool aSpQ(int argc, char* argv[])
{
if(argc != 7)
{
usageASpQ();
return false;
}
FILE* input = fileRead(argv[3]);
string type = string(argv[4]);
int num = atoi(argv[5]);
FILE* output = fileWrite(argv[6]);
ASp* asp = new ASp(input);
asp->T_B_P_N(type.c_str(), num);
for(int i = 0; i < asp->numtr; i++)
{
asp->fs[i]->print(output);
}
fclose(input);
fclose(output);
return true;
}
Those files compiled with no problems when they were included in another cpp file.
I have another file called "PBL.cpp". This compiled fine before, until I tried to include the files above in PBL.cpp
#include "ASp/ASp.h"
using namespace ASP;
using namespace std;
//bunch of code
bool aSpQ(char * fname_r, string type, int num, char * fname_q)
{
FILE* input = fileRead(fname_r);
FILE* output = fileWrite(fname_q);
ASp* asp = new ASp(input);
asp->T_B_P_N(type.c_str(), num);
for(int i = 0; i < asp->numtr; i++)
{
asp->fs[i]->print(output);
}
fclose(input);
fclose(output);
return true;
}
When I try to compile this, at the line of
ASp* asp = new ASp(input);
in the PBL.cpp file
I get the following errors:
I get errors of undefined reference to ASP::ASp::ASp(_IOFILE*) and undefined reference to ASP::ASp::T_B_P_N(char const*, int)