g++ main.cc
Undefined first referenced
symbol in file
vtable for Literal /var/tmp//ccBK9IR0.o
vtable for BooleanExp /var/tmp//ccBK9IR0.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
The code I am compiling is all located in one file (lines commented in main are trying to locate errors in headers):
Expand|Select|Wrap|Line Numbers
- // Second attempt
- #include <iostream>
- using namespace std;
- // Will be BooleanExp.h
- class BooleanExp {
- public:
- virtual ~BooleanExp();
- virtual bool GetValue();
- protected:
- BooleanExp();
- };
- // Will be BooleanExp.cc
- BooleanExp::BooleanExp() {};
- // Will be Literal.h
- class Literal : public BooleanExp {
- public:
- virtual ~Literal();
- //protected:
- Literal( bool * );
- private:
- bool _value;
- };
- // Will be Literal.cc
- Literal::Literal(bool * v) {
- _value = v;
- }
- // Will be main.cc
- int main() {
- //Literal * a;
- //a = new Literal(0);
- cout << "So far so good/n";
- //delete a;
- }
Tex