I'm creating a college project that uses OOP in C++. For the first part of it, i had several classes and it all worked fine. But for the second part I had to implement polymorphism and it broke my code. Basically, the only difference between the first part and what I have now is exception handling and two more classes that have one parent class.
I had one class called "Cliente" that had no problems in the first part of the project, but now I'm getting "undefined reference to" for all of it's getters. I have no clue of what it could be, because I've not modified that class at all. Here is the .h and the .cpp for the class Cliente
Cliente.h
#ifndef CLIENTE
#define CLIENTE
#include <string>
using namespace std;
class Cliente {
private:
string nomeCliente;
string cpf_cnpj;
string endereco;
string fone;
public:
Cliente(string nomeCliente, string cpf_cnpj, string endereco, string fone);
void setNomeCliente(string nomeCliente);
string getNomeCliente() const;
void setCpf_cnpj(string cpf_cnpj);
string getCpf_cnpj() const;
void setEndereco(string endereco);
string getEndereco() const;
void setFone(string fone);
string getFone() const;
};
#endif // CLIENTE
Cliente.cpp
#include "cliente.h"
#include <string>
Cliente::Cliente(string _nomeCliente, string _cpf_cnpj, string _endereco, string _fone){
endereco = _endereco;
cpf_cnpj = _cpf_cnpj;
nomeCliente = _nomeCliente;
fone = _fone;
}
void Cliente::setNomeCliente(string _nomeCliente){
nomeCliente = _nomeCliente;
}
string Cliente::getNomeCliente() const{
return nomeCliente;
}
void Cliente::setCpf_cnpj(string _cpf_cnpj){
cpf_cnpj = _cpf_cnpj;
}
string Cliente::getCpf_cnpj() const{
return cpf_cnpj;
}
void Cliente::setEndereco(string _endereco){
endereco = _endereco;
}
string Cliente::getEndereco() const{
return endereco;
}
void Cliente::setFone(string _fone){
fone = _fone;
}
string Cliente::getFone() const{
return fone;
}
The errors that I'm getting are from another class, but all of them are referring to Cliente.h.
Here is some of them:
Banco.cpp|22|undefined reference to 'Cliente::getCpf_cnpj[abi:cxx11]() const'
Banco.cpp|263|undefined reference to 'Cliente::getFone[abi:cxx11]() const'