• 5262阅读
  • 3回复

config+=dll遇到的问题 [复制链接]

上一主题 下一主题
离线vcloud
 
只看楼主 倒序阅读 楼主  发表于: 2010-02-01
今天我把qt重新编译成了静态库,用的-debug-and-release -static选项,然后我用qt creator新建了一个动态c++链接库。按照默认的设置是能够成功生成*.o文件,可我想生成dll文件,所以我在配置文件里加了“config+=dll”,但是能够成功生成debug版的dll文件,但是不能生成release版的dll文件。

下面是配置文件:
  1. TARGET = DynamicTest
  2. TEMPLATE = lib
  3. DEFINES += DYNAMICTEST_LIBRARY
  4. SOURCES += dynamictest.cpp
  5. HEADERS += dynamictest.h\
  6.         DynamicTest_global.h
  7. CONFIG  +=  dll


头文件:

  1. #ifndef DYNAMICTEST_H
  2. #define DYNAMICTEST_H
  3. #include "DynamicTest_global.h"
  4. #include <QtGui/QDialog>
  5. class DYNAMICTESTSHARED_EXPORT DynamicTest:public QDialog {
  6. public:
  7.     DynamicTest(QWidget *parent=0);
  8. };
  9. #endif // DYNAMICTEST_H



源文件:
  1. #include "dynamictest.h"
  2. DynamicTest::DynamicTest(QWidget *parent):QDialog(parent)
  3. {
  4. }



下面是错误信息:

Running build steps for project DynamicTest...
Starting: c:/qt/2010.01/qt/bin/qmake.exe D:/program/qtcreator/DynamicTest/DynamicTest.pro -spec win32-g++ -r CONFIG+=release
Exited with code 0.
Starting: C:/Qt/2010.01/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `D:/program/qtcreator/DynamicTest'
C:/Qt/2010.01/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `D:/program/qtcreator/DynamicTest'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -shared -mthreads -Wl -Wl,--out-implib,release\libDynamicTest.a -o release\DynamicTest.dll release/dynamictest.o -L"c:\Qt\2010.01\qt\lib" -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
Creating library file: release\libDynamicTest.a
mingw32-make[1]: Leaving directory `D:/program/qtcreator/DynamicTest'
mingw32-make: Leaving directory `D:/program/qtcreator/DynamicTest'
release/dynamictest.o:dynamictest.cpp:(.text+0x24): undefined reference to `_imp___ZN7QDialogC2EP7QWidget6QFlagsIN2Qt10WindowTypeEE'
release/dynamictest.o:dynamictest.cpp:(.text+0x60): undefined reference to `_imp___ZN7QDialogC2EP7QWidget6QFlagsIN2Qt10WindowTypeEE'
release/dynamictest.o:dynamictest.cpp:(.text$_ZN11DynamicTestD1Ev[DynamicTest::~DynamicTest()]+0x17): undefined reference to `_imp___ZN7QDialogD2Ev'
release/dynamictest.o:dynamictest.cpp:(.text$_ZN11DynamicTestD0Ev[DynamicTest::~DynamicTest()]+0x1c): undefined reference to `_imp___ZN7QDialogD2Ev'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\DynamicTest.dll] Error 1
mingw32-make: *** [release] Error 2
Exited with code 2.
Error while building project DynamicTest
When executing build step 'Make'

请各位看看是什么原因。
离线vcloud
只看该作者 1楼 发表于: 2010-02-01
重新清空了一下工程之后,debug版的也生成不了了
离线downstairs

只看该作者 2楼 发表于: 2010-02-01
用qmake 详细教程去GG
喜爱编程的猫头鹰
离线benbenmajia

只看该作者 3楼 发表于: 2010-02-01
windows系统?
安然.....
快速回复
限100 字节
 
上一个 下一个