Qt 4.8.4在调试模式编译中给出错误

时间:2013-07-25 11:01:48

标签: qt qt4.8

我为Visual Studio 2010安装了Qt 4.8.4 QT-双赢开源-4.8.4-vs2010.exe
http://download.qt-project.org/archive/qt/4.8/4.8.4/

Qt项目文件:

LIBS += -lqaxserver \  
        -lqaxcontainer

在我的Qt GUI应用程序中,我使用QAxobject来访问ms-excel。

当我在发布模式下编译项目时,我没有收到任何错误。 GUI正在按预期运行。我可以使用QAxObject对象生成excel文件。

但是我在进行调试构建时遇到以下3个错误:

file not found: qaxcontainer.lib(qaxbase.obj)
file not found: qaxcontainer.lib(qaxobject.obj)
file not found: qaxcontainer.lib(qaxtypes.obj)

为什么这只发生在调试版本中?我该如何解决?

编辑:----

我评论了LIBS&补充说。仍然没有更改发布模式正在编译调试正在给出错误。

#LIBS += -lqaxserver \
#        -lqaxcontainer
CONFIG += qaxserver
CONFIG += qaxcontainer

现在我遇到了七个错误:----

AxServerd.lib(qaxtypes.obj) : error LNK2005: "class QColor __cdecl OLEColorToQColor(unsigned int)" (?OLEColorToQColor@@YA?AVQColor@@I@Z) already defined in QAxContainerd.lib(qaxtypes.obj)
QAxServerd.lib(qaxtypes.obj) : error LNK2005: "bool __cdecl QVariantToVARIANT(class QVariant const &,struct tagVARIANT &,class QByteArray const &,bool)" (?QVariantToVARIANT@@YA_NABVQVariant@@AAUtagVARIANT@@ABVQByteArray@@_N@Z) already defined in QAxContainerd.lib(qaxtypes.obj)
QAxServerd.lib(qaxtypes.obj) : error LNK2005: "bool __cdecl QVariantToVoidStar(class QVariant const &,void *,class QByteArray const &,unsigned int)" (?QVariantToVoidStar@@YA_NABVQVariant@@PAXABVQByteArray@@I@Z) already defined in QAxContainerd.lib(qaxtypes.obj)
QAxServerd.lib(qaxtypes.obj) : error LNK2005: "class QVariant __cdecl VARIANTToQVariant(struct tagVARIANT const &,class QByteArray const &,unsigned int)" (?VARIANTToQVariant@@YA?AVQVariant@@ABUtagVARIANT@@ABVQByteArray@@I@Z) already defined in QAxContainerd.lib(qaxtypes.obj)
QAxServerd.lib(qaxtypes.obj) : error LNK2005: "void __cdecl clearVARIANT(struct tagVARIANT *)" (?clearVARIANT@@YAXPAUtagVARIANT@@@Z) already defined in QAxContainerd.lib(qaxtypes.obj)
QAxServerd.lib(qaxserver.obj) : error LNK2019: unresolved external symbol "class QAxFactory * __cdecl qax_instantiate(void)" (?qax_instantiate@@YAPAVQAxFactory@@XZ) referenced in function "class QAxFactory * __cdecl qAxFactory(void)" (?qAxFactory@@YAPAVQAxFactory@@XZ)
debug\geny.exe : fatal error LNK1120: 1 unresolved externals
    link /LIBPATH:"c:\Qt\4.8.4\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /MANIFEST /MANIFESTFILE:"debug\geny.intermediate.manifest" /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /OUT:debug\geny.exe @C:\Users\dguleria\AppData\Local\Temp\geny.exe.17776.15.jom
    C:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug

1 个答案:

答案 0 :(得分:2)

这是因为在调试版本中库的名称不同。您不应该将LIBS用于Qt库。您应该通过执行以下操作告诉qmake找出链接选项:

CONFIG += qaxcontainer

这里有记录: http://qt-project.org/doc/qt-4.8/activeqt-container.html