Pregunta

I have project like this: enter image description here When I try to compile this,get error:undefined reference to `Foo::Foo()'

I have compiled gtest 1.7 and gmock 1.7,and copied all libg* to /user/lib,and my build setting like this: enter image description here

enter image description here

and project paths and symbols like this: enter image description here

Update: got a new error enter image description here

¿Fue útil?

Solución

undefined reference is a linker error, indicating the linker could not find implementation for the specific method.

try to add a implementation for you foo constructor in foo.h

Change:

virtual ~Foo();
Foo();
bool foo(void) { return true; }

To

virtual ~Foo();
Foo() {} //add default implementation
bool foo(void) { return true; }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top