Hi,
I'm having some trouble with libraries. I am having an undefined reference.
C:file:-1: error: undefined reference to `_imp___ZTV13OrderStrategy'
C:file:-1: error: release/LibraryB.o: bad reloc address 0x1 in section `.text$_ZN13LibraryBD1Ev[__ZN13LibraryByD1Ev]'
Library A is compliled and located in its own release folder.
Library B implements an interface from library A.
Which header need i to use as header for the base of InterfaceAImp?
I have chosen for Library A - > InterfaceA.h with an unified LIBRARYA_LIBRARY. So the header will be class Q_DECL_IMPORT InterfaceA. somthing is going wrong but I dont know what.
Any help is appreciated,
Delphi
Library A class:
#if defined(LIBRARYA_LIBRARY)
# define INTERFACESHARED_EXPORT Q_DECL_EXPORT
#else
# define INTERFACESHARED_EXPORT Q_DECL_IMPORT
#endif
class INTERFACESHARED_EXPORT InterfaceA
{
public:
virtual ~InterfaceA(){}
};
#if defined(LIBRARYA_LIBRARY)
# define INTERFACESHARED_EXPORT Q_DECL_EXPORT
#else
# define INTERFACESHARED_EXPORT Q_DECL_IMPORT
#endif
class INTERFACESHARED_EXPORT InterfaceA
{
public:
virtual ~InterfaceA(){}
virtual QString* run() =0;
};
To copy to clipboard, switch view to plain text mode
Library B *.pro
QT -= gui
TARGET = Implementation
TEMPLATE = lib
DEFINES += IMPLEMENTATION_LIBRARY
DEPENDPATH += . ../LibraryA
INCLUDEPATH += ../LibraryA
LIBS+= -L../LibraryA/release -lLibraryA
QT -= gui
TARGET = Implementation
TEMPLATE = lib
DEFINES += IMPLEMENTATION_LIBRARY
DEPENDPATH += . ../LibraryA
INCLUDEPATH += ../LibraryA
LIBS+= -L../LibraryA/release -lLibraryA
To copy to clipboard, switch view to plain text mode
library B class
#if defined(LIBRARYB_LIBRARY)
# define IMPLEMENTATIONSHARED_EXPORT Q_DECL_EXPORT
#else
# define IMPLEMENTATIONSHARED_EXPORT Q_DECL_IMPORT
#endif
#include "InterfaceA" // header file from Library A, dir: ../LibraryA
class IMPLEMENTATIONSHARED_EXPORT InterfaceAImp : public InterfaceA
{
public:
InterfaceAImp
virtual ~InterfaceAImp(){}
virtual QString* run
(){return "Hello world";
} };
#if defined(LIBRARYB_LIBRARY)
# define IMPLEMENTATIONSHARED_EXPORT Q_DECL_EXPORT
#else
# define IMPLEMENTATIONSHARED_EXPORT Q_DECL_IMPORT
#endif
#include "InterfaceA" // header file from Library A, dir: ../LibraryA
class IMPLEMENTATIONSHARED_EXPORT InterfaceAImp : public InterfaceA
{
public:
InterfaceAImp
virtual ~InterfaceAImp(){}
virtual QString* run(){return "Hello world";}
};
To copy to clipboard, switch view to plain text mode
Bookmarks