Question

I have installed Qt 4.8.4 for Visual Studio 2010.
qt-win-opensource-4.8.4-vs2010.exe
http://download.qt-project.org/archive/qt/4.8/4.8.4/

Qt project file:

LIBS += -lqaxserver \  
        -lqaxcontainer

In my Qt GUI application I am using QAxobject to access ms-excel.

When I compile my project in release mode, I do not get any error. And GUI is running as expected. I am able to generate excel files using QAxObject objects.

But I am getting the following 3 errors when doing a debug build:

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

Why does this happen only in debug builds? How do I solve it?

Edit :----

I commented LIBS & added CONFIG. Still no change release mode is compiling debug is giving error.

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

Now i am getting seven errors :----

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
Was it helpful?

Solution

That's because the libraries are named differently in the debug version. You shouldn't use LIBS for Qt libraries. You should be telling qmake to figure out the link options by doing:

CONFIG += qaxcontainer

This is documented here: http://qt-project.org/doc/qt-4.8/activeqt-container.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top