Mayur J February 2016

C++ library not able to locate another library it uses

I am building a C++ Console Application with custom built SDK. I have the header files and the libraries but I do not have the source code (Implementation).

In one particular case, because of being in different namespaces, a method in one class (Lets say Class A) is not able to access a Class B.

How can I fix this issue knowing that I don't have the Source code.

In the main function, I create an object reference by writing the following command:

Event *event=new Event(); 

On writing this statement, I get the following compiler error:

(Event.o): In function com::egi::services::mff::api::Event::setBeginTime(EGIBase::EGIXStringWrap)': Event.cpp:(.text+0xacd): undefined reference to EGIBase::EGIXStringWrap::getStringCopy[abi:cxx11]()'

Code is as follows:

#include "Event.h"
#include "EGIXStringWrap.h"
int main()
{
    Event *event=new Event(); // This is where the error crops up.`
}

PS: EGIXStringWrap and Event are the classes. The setBeginTime() method of Event calls the getStringCopy() method of EGIXStringWrap

Answers


K. Gkinis February 2016

(Event.o): In function com::egi::services::mff::api::Event::setBeginTime(EGIBase::EGIXStringWrap)': Event.cpp:(.text+0xacd): undefined reference to EGIBase::EGIXStringWrap::getStringCopy[abi:cxx11] ()'

Given what you have posted, it means that the function setBeginTime() of the Event Class, in the namespace com::egi::services::mff::api, has an argument of type EGIXStringWrap that belongs to the EGIBase namespace.

All is well till here, since the compiler keeps resolving after that line. We can deduce that the namespace EGIBase is visible to the library of the class Event.

Assumption:

Then, the compiler can't find a reference to getStringCopy, inside the EGIBase::EGIXStringWrap namespace, which is in a binary form (maybe a .o) expected to be built with a C++ 11 compatible compiler.

Given that my assumption is correct:

First of all, it is unlikely that you can do anything, given that those libraries are given to you already compiled, better contact their provider.

Secondly, getStringCopy is in the same namespace, EGIBase, so it must be visible.

Apart from that, I find it unlikely that the produced binary library is incompatible with a library of a previous C++ version (although not impossible).


Robert Bell February 2016

Just in case one of our other customers hits this issue, it is just a link order problem; the libraries are fine. Contact our support if you have questions- EGI.

Post Status

Asked in February 2016
Viewed 1,557 times
Voted 11
Answered 2 times

Search




Leave an answer