2013-07-25 38 views
1

我已经安装的Qt 4.8.4 Visual Studio 2010中
QT-双赢开源-4.8.4-vs2010.exe
http://download.qt-project.org/archive/qt/4.8/4.8.4/的Qt 4.8.4在调试模式下编译给错误

Qt工程文件:

 
LIBS += -lqaxserver \ 
     -lqaxcontainer 

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

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

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

为什么会发生这种情况仅在调试版本:

但这样做调试版本时,我得到了以下3个错误?我如何解决它?

编辑:----

我评论LIBS &添加CONFIG。仍然没有更改发布模式正在编译调试正在给出错误。

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

现在我得到7个错误:----

AxServerd.lib(qaxtypes.obj) : error LNK2005: "class QColor __cdecl OLEColorToQColor(unsigned int)" ([email protected]@[email protected]@[email protected]) 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)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 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)" ([email protected]@[email protected]@[email protected]@[email protected]) 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)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) already defined in QAxContainerd.lib(qaxtypes.obj) 
QAxServerd.lib(qaxtypes.obj) : error LNK2005: "void __cdecl clearVARIANT(struct tagVARIANT *)" ([email protected]@[email protected]@@Z) already defined in QAxContainerd.lib(qaxtypes.obj) 
QAxServerd.lib(qaxserver.obj) : error LNK2019: unresolved external symbol "class QAxFactory * __cdecl qax_instantiate(void)" ([email protected]@[email protected]@XZ) referenced in function "class QAxFactory * __cdecl qAxFactory(void)" ([email protected]@[email protected]@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

这是因为库的调试版本命名不同。 Qt库不应该使用LIBS。你应该告诉QMAKE做找出链接选项:

 
CONFIG += qaxcontainer 

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

+0

仍然没有工作的调试模式。我已经编辑了原来的职位..请参阅错误有..任何建议? – Katoch

+0

@Katoch确保在构建之前执行“干净”的步骤。还要确保你的项目文件中没有任何硬编码的库路径。 –

+0

我们必须包括的仅仅是 - CONFIG + = qaxcontainer ---然后它工作..谢谢 – Katoch

相关问题