schall_l
27th March 2008, 18:36
Hello,
I am trying to create a simple dll containing some qt code.
I thought that this would be easy, but somehow I am getting a compiler error telling me:
1>------ Build started: Project: dll_test, Configuration: Debug Win32 ------
1>Compiling...
1>moc_qtestdll.cpp
1>qtestdll.cpp
1>Generating Code...
1>Linking...
1> Creating library ..\..\libs\dll_test.lib and object ..\..\libs\dll_test.exp
1>qtmaind.lib(qtmain_win.obj) : error LNK2019: unresolved external symbol _main referenced in function _WinMain@16
1>..\..\libs\dll_test.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\tmp\project\lab\dll_test\debug\BuildLog.htm"
1>dll_test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It looks like that my Visual C++ compiler is trying to compile this as an apllication.
This is my code:
dll_test.pro
TEMPLATE = lib
CONFIG += dll qt thread
# DEFINES only for Windows
win32 {
CONFIG(dll) {
DEFINES += BUILD_DLL
}
}
# Input
HEADERS += src/qtestdll.h
SOURCES += src/qtestdll.cpp
qtestdll.h
#ifndef QTTESTDLL_H
#define QTTESTDLL_H
#ifdef BUILD_DLL
#define EXPORT_DLL Q_DECL_EXPORT // for Windows
#else
#define EXPORT_DLL
#endif
#include <QtGui>
#include <QObject>
class EXPORT_DLL myTestLib : public QObject {
Q_OBJECT
public:
myTestLib() {};
~myTestLib(){};
void printOut();
};
#endif
qtestdll.cpp
#include "qtestdll.h"
void myTestLib::printOut() {
QMessageBox::information (
NULL,
QObject::tr("Yeahh"),
QObject::tr("This message box comes"
" from my dynamic library") );
}
As usual I did qmake dll_test.pro and qmake -t vcapp to generate the Makefile and the Visual Studio project.
If anyone has an idea...
I am trying to create a simple dll containing some qt code.
I thought that this would be easy, but somehow I am getting a compiler error telling me:
1>------ Build started: Project: dll_test, Configuration: Debug Win32 ------
1>Compiling...
1>moc_qtestdll.cpp
1>qtestdll.cpp
1>Generating Code...
1>Linking...
1> Creating library ..\..\libs\dll_test.lib and object ..\..\libs\dll_test.exp
1>qtmaind.lib(qtmain_win.obj) : error LNK2019: unresolved external symbol _main referenced in function _WinMain@16
1>..\..\libs\dll_test.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\tmp\project\lab\dll_test\debug\BuildLog.htm"
1>dll_test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It looks like that my Visual C++ compiler is trying to compile this as an apllication.
This is my code:
dll_test.pro
TEMPLATE = lib
CONFIG += dll qt thread
# DEFINES only for Windows
win32 {
CONFIG(dll) {
DEFINES += BUILD_DLL
}
}
# Input
HEADERS += src/qtestdll.h
SOURCES += src/qtestdll.cpp
qtestdll.h
#ifndef QTTESTDLL_H
#define QTTESTDLL_H
#ifdef BUILD_DLL
#define EXPORT_DLL Q_DECL_EXPORT // for Windows
#else
#define EXPORT_DLL
#endif
#include <QtGui>
#include <QObject>
class EXPORT_DLL myTestLib : public QObject {
Q_OBJECT
public:
myTestLib() {};
~myTestLib(){};
void printOut();
};
#endif
qtestdll.cpp
#include "qtestdll.h"
void myTestLib::printOut() {
QMessageBox::information (
NULL,
QObject::tr("Yeahh"),
QObject::tr("This message box comes"
" from my dynamic library") );
}
As usual I did qmake dll_test.pro and qmake -t vcapp to generate the Makefile and the Visual Studio project.
If anyone has an idea...