Book class project

My header(book.h) compiles properly but when compiling my book.cc, i get the error

bash-3.2$ g++ -Wall -std=c++11 book.cc
Undefined first referenced
symbol in file
main /usr/lib/crt1.o
ld: fatal: symbol referencing errors. No output written to a.out

Not sure what this means or what's causing this.

My header is:
-----------------------------------------------------
#ifndef book_h
#define book_h
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>

using namespace std;

class Book {
public:
Book();
Book(string new_name, int new_year, string new_author);
Book(string all_data);
void display();
void setTitle(string new_title);
string getTitle();
void setYear(int new_year);
int getYear();
void setAuthor(string new_author);
string getAuthor();
bool match_title(string target_title);
bool match_author(string target_author);
bool match_year(string target_year);
bool match(string target);
friend ostream& operator << (ostream &out, const Book b);
friend bool operator == (const Book &b, const Book &b2);
private:
string title;
int year;
string author;
};
#endif
---------------------------------
My book.cc:
---------------------------------
#include "book.h"
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>

using namespace std;

Book::Book(){//Initializing objects in class
title = "***";
year = 0;
author = "***";
}
Book::Book(string new_title, int new_year, string new_author){//Initializing objects to specific parameters
title = new_title;
year = new_year;
author = new_author;
}
Book::Book(string all_data){//Splits string into three book properties
string converter;
int found = all_data.find("|");
title = all_data.substr(0, found);
int found2 = all_data.find("|",found+1);
converter = all_data.substr(found+1,found2);
year = atoi(converter.c_str());;
author = all_data.substr(found2+1);
cout << title << " " << year << " " << author;
}
void Book::setTitle(string new_title){//setting title
title = new_title;
}
string Book::getTitle(){//getting title
return title;
}
void Book::setYear(int new_year){//setting year
year = new_year;
}
int Book::getYear(){//getting year
return year;
}
void Book::setAuthor(string new_author){//setting author
author = new_author;
}
string Book::getAuthor(){//getting author
return author;
}
bool Book::match_title(string target_title){//this function matches target title to title of book
string temp = title;
int length = temp.length();
for(int i=0;i<length;i++){//converting to lowercase
if (isupper(temp[i])){
temp[i]=tolower(temp[i]);
}
}
for(int i=0;i<length;i++){//converting to lowercase
if (isupper(target_title[i])){
target_title[i]=tolower(target_title[i]);
}
}
if(temp.find(target_title) != string::npos){
return true;
}
else {
return false;
}
}
bool Book::match_author(string target_author){//matching target author to author of book
string temp = author;
int length = temp.length();
for(int i=0;i<length;i++){//converting to lowercase
if (isupper(temp[i])){
temp[i]=tolower(temp[i]);
}
}
for(int i=0;i<length;i++){//converting to lowercase
if (isupper(target_author[i])){
target_author[i]=tolower(target_author[i]);
}
}
if(temp.find(target_author) != string::npos){
return true;
}
else {
return false;
}
}
bool Book::match_year(string target_year){//matching target year to year of book
string temp = to_string(year);//converting year to string to be matched

if(temp.find(target_year) != string::npos){
return true;
}
else {
return false;
}
}
bool Book::match(string target){//matches target to any of the books properties
if (match_title(target)==true){
return true;
}
else if (match_year(target)==true){
return true;
}
else if (match_author(target)==true){
return true;
}
else return false;
}
ostream& operator << (ostream &out, const Book b){//overload the << operator
out << b.title << endl;
out << b.year << endl;
out << b.author << endl;
return out;
}
bool operator == (const Book &b, const Book &b2){//overload the == operator
return (b.title == b2.title && b.year == b2.year && b.author == b2.author);
}

Thanks in advance for any help!
Line 90: to_string() is undefined.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.


Topic archived. No new replies allowed.