I created a static Qt library by using VS2005.
It created an extra file "test_global.h" besides expected ones(test.h and test.cpp).
test_global.h
#ifndef TEST_GLOBAL_H
#define TEST_GLOBAL_H
#include <Qt/qglobal.h>
#ifdef TEST_LIB
# define TEST_EXPORT Q_DECL_EXPORT
#else
# define TEST_EXPORT Q_DECL_IMPORT
#endif
#endif // TEST_GLOBAL_H
Why this file is generated, how I suppose to use it?
Thanks.
You mark your class (or methods) as exported in your library headers:
Then in your library pro file you add:
So during the dll compilation your class header will have "Q_DECL_EXPORT" macro which is Qt way to tell the linker "export this class/method", and when you use your dll in some application, the header will have "Q_DECL_IMPORT" macro.
For more information, check the Qt documentation.