0

.H file

#ifndef PROJECT_FILE_H
#define PROJECT_FILE_H

#include <iostream>
#include <stdio.h>

class File {
public:
    File();
    File(char *);
    File(const File&);
...

.CPP file

File::File(){ }
File::File(char *_t) : t(_t) {
    try {
        test();
    }
        catch (Exception &e) {
            std::cerr << e.what() << std::endl;
        }

}

File::File(const File &other): t(other.v1),t1(other.v2),t2(other.v3){ }

I get undefined reference to vtable for File error on each constructor. there is no pure virtual function definition in the class. the cmake file include both h/cpp files. What might be the problem? Thanks.

Neet33
  • 241
  • 1
  • 5
  • 17
  • This is a crappy error message; it usually arises when you forget to provide bodies for virtual functions. If the duplicate link does not help you then please edit your question to contain a [MCVE](http://stackoverflow.com/help/mcve). – M.M Aug 04 '15 at 23:43
  • Error messages are not part of the C++ language. They are specific to a compiler. Please provide relevant information (compiler and version). – IInspectable Aug 04 '15 at 23:44
  • 1
    The error occurred because I forgot there was a virtual function in the code that was not defined. – Neet33 Aug 04 '15 at 23:48

0 Answers0