[Solved] Simple initializer problem
-
Additionally you could run qmake again.
If you want to be clear which code is used by the preprocessor you want to use a statement like this:
@#error "Simple"@
But I don't understand why you define the EXPORT and the IMPORT macro when using only the EXPORT in your class definition.
-
Hi franku,
You are right, but DEFINES qmake adds the values of this variable as compiler C preprocessor macros (-D option). So, when I add the line:
@# interface_mngr.pro
DEFINES +=
INTERFACEMNGRLIB_LIBRARY@it add
@#define INTERFACEMNGRLIB_LIBRARY@
Thank you for your time.
PD: When create shared lib follow this "link":http://doc.qt.nokia.com/4.7-snapshot/sharedlibrary.html#header-file-considerations
-
Hi, I know. This is the reason why I asked you to rebuild your makefiles using qmake. Just to be shure having the -D commandline parameter being passed to the compiler. Read the contents of the link again carefully to see where the difference is to your code.
You can use the #error to stop the preprocessor if you want to know which line is really evaluated.
-
I have found a strange issue:
I delete all references to InterfaceMngr in the file core.h and core.cpp, and found that the library compile without errors, but when I try to use it, give the compile error referenced here before.
BR,
-
Shouldn't it be:
@
#if defined(INTERFACEMNGRLIB_LIBRARY)define INTERFACEMNGR_EXPORT Q_DECL_EXPORT
#else
define INTERFACEMNGR_EXPORT Q_DECL_IMPORT
#endif
@otherwise, INTERFACEMNGR_EXPORT will not be defined when you try to use the exported symbol.
-
Hi Arnold,
I have other two similars definitions but don't have any problem.
The libraries "ModuleMngr":https://github.com/thanatosJSSE/Sipred/blob/master/src/managers/module/modulemngr.h and "PluginMngr":https://github.com/thanatosJSSE/Sipred/blob/master/src/managers/plugin/pluginmngr.h.Thank you.
-
In both pluginmngr_global.h and modulmngr_global.h the declaration looks like this
@
#ifndef PLUGINMNGR_GLOBAL_H
#define PLUGINMNGR_GLOBAL_H#include <QtCore/QtGlobal>
#if defined(PLUGINMNGRLIB_LIBRARY)
define PLUGINMNGR_EXPORT Q_DECL_EXPORT
#else
define PLUGINMNGR_EXPORT Q_DECL_IMPORT
#endif
#endif // PLUGINMNGR_GLOBAL_H
@which is exactly what i suggested.
Regards,
Arnold -
If i am not wrong there is a missing ";" after Q_DECLARE_PRIVATE(InterfaceMngr):
@
private:
Q_DECLARE_PRIVATE(InterfaceMngr) ; //here};
@ -
That's right, interfacemngr have his own interfacemngr_global.h.
And this looks like you suggest.
BR,
-
[quote author="Neutron Stein" date="1343136256"]If i am not wrong there is a missing ";" after Q_DECLARE_PRIVATE(InterfaceMngr):
@
private:
Q_DECLARE_PRIVATE(InterfaceMngr) ; //here};
@[/quote]There is no problem, I tried that too, without results.
I found that this library is compiled, but when I try to use it give me that error. -
Ok,
Thank everyone that helped me to take a look to mi code.
Well the problem was a personal mistake:@#if defined(INTERFACEMNGRLIB_LIBRARY)
define INTERFACEMNGR_EXPORT Q_DECL_EXPORT
#else
define INTERFACEMNGR_IMPORT Q_DECL_IMPORT <---- ERROR!!!
#endif@
Must be EXPORT like Arnold said
BR,