Does your code export any symbols? It's possible that there will be no import library if there are no exported symbols to import. See Creating Shared Libraries. I get an import library when I do a trivial example using the MingW tools (I don't have MSVC handy) but GCC exports by default.
Does this simple example do what you expect?
// Pro file
TEMPLATE = lib
QT -= core gui
CONFIG += dll
DEFINES += MYSHAREDLIB_LIBRARY
SOURCES += mysharedlib.cpp
// mysharedlib.h
#include <QtCore/QtGlobal>
#if defined(MYSHAREDLIB_LIBRARY)
# define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
# define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif
MYSHAREDLIB_EXPORT int doSomethingInsightful();
class MYSHAREDLIB_EXPORT ExportedClass {
ExportedClass();
int doSomething();
};
// mysharedlib.cpp
#include "mysharedlib.h"
int doSomethingInsightful()
{
return 42;
}
ExportedClass::ExportedClass()
{
}
int ExportedClass::doSomething()
{
return 0;
}
// Pro file
TEMPLATE = lib
QT -= core gui
CONFIG += dll
DEFINES += MYSHAREDLIB_LIBRARY
SOURCES += mysharedlib.cpp
// mysharedlib.h
#include <QtCore/QtGlobal>
#if defined(MYSHAREDLIB_LIBRARY)
# define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
# define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif
MYSHAREDLIB_EXPORT int doSomethingInsightful();
class MYSHAREDLIB_EXPORT ExportedClass {
ExportedClass();
int doSomething();
};
// mysharedlib.cpp
#include "mysharedlib.h"
int doSomethingInsightful()
{
return 42;
}
ExportedClass::ExportedClass()
{
}
int ExportedClass::doSomething()
{
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks