[SOLVED] Issue when using class created with my Dll
-
@BlackMamba said:
OBOSHARED_EXPORT
Do you used this also for El?
The library .pro file should be enough.Seems the the El constructor in not available outside the library.
-
I didn't use this for the EI class, let me try that !
-
Now it compiles but crashes immediately when I execute the code.
Here is the pro file :- include(Obo.pri)
QT -= gui
TARGET = Obo
TEMPLATE = lib
DEFINES += Obo_LIBRARY
SOURCES += Obo.cpp
HEADERS += Obo.h
Obo_global.h
unix {
target.path = /usr/lib
INSTALLS += target
}
and the .pri file :
- SOURCES +=
...
$$PWD/src/OboInterface/EI.cpp
HEADERS +=
$$PWD/src/OboInterface/EI.h
...
DEPENDPATH += $$PWD/src/OboInterface
INCLUDEPATH+= $$PWD/src/OboInterface
- include(Obo.pri)
-
Ok,
where's the crash? which line? Are you able to collect a crash dump?
-
It crashes at the same line, when I try to instantiate the object :
EI myEI; -
How is defined El??
Try to provide as much information as possible; otherwise we'll be not able to help you
-
With an empty class, I have the same issue :
- #ifndef EI_H
#define EI_H
class EI
{
public:
EI();
~EI();
};#endif // EI_H
main.obj:-1: erreur : LNK2019: unresolved external symbol "public: __cdecl EI::EI(void)" (??0EI@@QEAA@XZ) referenced in function main
With this :
#ifndef EI_H
#define EI_H#include "obo_global.h"
class OBOSHARED_EXPORT EI
{
public:
EI();
~EI();
};#endif // EI_H
same error :(
- #ifndef EI_H
-
I mean the implementation of El.
Can you post the crash dump?
-
After some clean, good news, I have a new mistake when I add OB0SHARED_EXPORT for the EI class:
main.obj:-1: erreur : LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl EI::EI(void)" (_imp??0EI@@QEAA@XZ) referenced in function main -
@mcosta I gave youi the implementation, I deleted all the methods, its an empty class with ctor and dtor only.
-
Sorry, if you don't show the code I can't help you!
-
@mcosta Please read my last answer ;)
-
So, now you have the link error or still the crash??
You said before you was able to compile and link but you get a crash and now again the link error. It's a little bit confusing
-
Now the crash ... Yes, its confusing for me too.
Thats looks so simple, I don't understand what I am doing wrong.
The crash means he cant find the EI cpp implementation at runtime. -
OMG!!!!! I am soooooo stupid ... I didn't update the copy of the Obo.dll .....
Sorry for your time mcosta !You gave me the right answer by adding OB0SHARED_EXPORT for the classes you need to use after ...
Thanks ! -
Ok, no problem!
Happy programming