okay, I keep getting this compiler error message:
Undefined. . . . . . . . . . . . . . . . . first referenced
symbol. . . .. . . . . . . . . . . . . . . . . . . in file
rob::Book::~Book() . . . . . . . . . . . /var/tmp//ccZWEnnc.o
rob::Book::Book() . . . . . . . . . . . . /var/tmp//ccZWEnnc.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect 2: ld returned 1 exit status
rob::Book::~Book() <===this is the destructor for class Book in namespace rob that I created, the other one is the default constructor. I've tried everything I can think of and more. I need some serious help, I still have a lot left to work on for this project lol
if you see anything that could be wrong please help. I had it working fine as one file, but when I split it up it stopped workingCode:
//class header file
#include <string>
#include <cstdlib>
using namespace std;
namespace rob
{
class Book
{
public:
~Book();
Book (const Book& b1);
void operator =(const Book& b1);
Book();
void print (ostream& outs);
void fill (istream& ins);
private:
string* title;
string* author;
int copies, dollars, cents;
};
}
//implementation file. I'll only put the destructor and default
//constructor because those are the problem ones
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <cctype>
#include "book.h" //header file
using namespace std;
using namespace rob;
namespace rob
{
Book::~Book()
{
delete title;
delete author;
}
Book::Book()
{
title = new string;
author = new string;
copies = 0;
dollars = 0;
cents = 0;
}
//etc etc etc, the rest works fine
}
//main program, just testing to see if it compiles (which it doesn't)
#include "book.h"
using namespace std;
using namespace rob;
int main()
{
Book b1;
return 0;
}