Reputation: 53
I declare an obj :
#include "abc.h"
class xxx
{
public:
xxx();
~xxx();
abc* q;
...
};
in the .cpp file i do the following
this->q=new abc();
<-error on this line with undefined reference to abc::abc()
In the console it also appears this error:
Dwarf Error: Offset (76195) greater than or equal to .debug_str size (1472).
anyone knows what could be wrong? i'm using eclipse, fedora 14
Upvotes: 1
Views: 1248
Reputation: 2318
It looks like the implementation of the abc class is not included in the build. Add the abc.cpp file to the build.
Upvotes: 0
Reputation: 70030
this->q=new abc();
<-error on this line with undefined reference to abc::abc()
From your error it seems that you have only the declaration of abc::abc()
and there is no definition present. Define abc::abc()
in source file or make it inline
in header file.
Upvotes: 0
Reputation: 206566
undefined reference to
abc::abc()
It is an Linking error which tells you that the linker could not find the definition for abc::abc()
.
Most likely, You only declared but did not define the no argument constructor for class abc
.
In your cpp
file you should have:
abc::abc()
{
}
If you already have it in place then, You should ensure that the source cpp file which has this definition is being properly linked to your project.
Upvotes: 1