dimanche 30 août 2015

Undefined Reference issue with C++ and Netbeans

I have the following files:

ListaEnc.hpp

#include "Elemento.hpp"
#include <cstdlib>
#include <iostream>

template<typename T>
class ListaEnc {

public:
    ListaEnc();
    ~ListaEnc();
...
Implementation of ListaEnc<T>

main.cpp:

#include "ListaEnc.hpp"
using namespace std;

int main(int argc, char** argv)
{
    ListaEnc<int>* teste = new ListaEnc<int>();

    return 0;
}

Poligono.hpp

#ifndef POLIGONO_HPP
#define POLIGONO_HPP

#include "Ponto.hpp"
#include "ListaEnc.hpp"
#include <string>

using namespace std;

class Poligono 
{
   ...
};

#endif  /* POLIGONO_HPP */

Poligono.cpp

#include "Poligono.hpp"

Poligono::Poligono(ListaEnc<Ponto> pontos, string nome)
{
    this->pontos = pontos;
    this->nome = nome;
}
...

I get these compile errors on Poligono.cpp:

/home/mariana/NetBeansProjects/TrabalhoCG/Poligono.cpp:12: undefined reference to `ListaEnc::~ListaEnc()'

The destructor for ListaEnc is empty, but is implemented. Does anyone know how to solve this problem?

Aucun commentaire:

Enregistrer un commentaire