How does one resolve link error with Qt? - qt

I'm new to Qt, and trying to compile and link a simple "Hello, World" program using Microsoft's "CL.exe". Any advice on how to do this?
The program is:
#include <QtGui>
int main ( int argc, char * argv [] )
{
QApplication app ( argc, argv ) ;
QLabel label ( "Hello, world!" ) ;
label.show() ;
return app.exec() ;
}
I compile and link with:
C:\PROGRA~1\MICROS~1.0\VC\bin\cl.EXE -nologo -Zm200 -Zc:wchar_t- -O2 -MD ^
-W3 -w34100 -w34189 -DUNICODE ^
-DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB ^
-DQT_THREAD_SUPPORT -DQT_NO_DYNAMIC_CAST ^
-I"C:\Qt\2010.05\qt\include\QtCore" ^
-I"C:\Qt\2010.05\qt\include\QtGui" ^
-I"C:\Qt\2010.05\qt\include" ^
-I"." ^
-I"C:\Qt\2010.05\qt\include\ActiveQt" ^
-I"release" ^
-I"C:\Qt\2010.05\qt\mkspecs\win32-msvc2008" ^
-I"C:\Progra~1\MICROS~1.0\VC\include" ^
Hello.cpp ^
/link /LIBPATH:"C:\Qt\2010.05\qt\lib" ^
/LIBPATH:"C:\Progra~1\MICROS~1.0\VC\lib" ^
/LIBPATH:"C:\Progra~1\MID05A~1\VC\PLATFO~1\Lib"
My linker errors include:
Hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pub
lic: virtual __thiscall QApplication::~QApplication(void)" (__imp_??1QApplicatio
n##UAE#XZ) referenced in function _main
Hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pub
lic: virtual __thiscall QLabel::~QLabel(void)" (__imp_??1QLabel##UAE#XZ) referen
ced in function _main
Hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pub
lic: static int __cdecl QApplication::exec(void)" (__imp_?exec#QApplication##SAH
XZ) referenced in function _main
Hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pub
lic: void __thiscall QWidget::show(void)" (__imp_?show#QWidget##QAEXXZ) referenc
ed in function _main
.
.
.
My Hello.pro file contains:
######################################################################
# Automatically generated by qmake (2.01a) Mon Dec 13 15:58:13 2010
######################################################################
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += Hello.cpp

You should be linking against QtCore and QtGui libraries but you don't. What does your .pro file look like?
Edited to add after the .pro file was posted: Your .pro file looks all right. You're not overwriting the QT variable which by default includes core gui, which should result in QtCode and QtGui being linked to. It's also evident by the fact that both QtCore and QtGui are present in your include paths.
I haven't used cl.exe with Qt but you could try adding LIBS += -lQtCore -lQtGui to force linking to QtCore and QtGui. (There's probably a more elegant fix though.)

Your PATH should include the qt/bin directory. In a Visual Studio Command Prompt you should do a "qmake hello.pro" which creates three makefiles, and then "nmake". If you want to use vcxproj files, you should change your TEMPLATE to vcapp.

trying to compile and link a simple
"Hello, World" program using
Microsoft's "CL.exe"
Hey i think there are easier ways of getting qt applications compiled on visual studio. Instead of struggling with commandline options why not install the qt visual studio addin that makes compiling projects soooooooo easy? Just a suggestion :)

Related

CLion setting up Qt and getting numerous errors stating 'undefined reference to '_imp___ZN

I am getting several undefined reference errors with using Qt. I am using MinGW as my compiler and I am using Qt version 5.15.2.
This is my CMake file:
cmake_minimum_required(VERSION 3.17)
project(jerseytraffic)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QT_VERSION 5)
set(REQUIRED_LIBS Core Gui Widgets)
set(REQUIRED_LIBS_QUALIFIED Qt5::Core Qt5::Gui Qt5::Widgets)
set(CMAKE_PREFIX_PATH "A:\\CppProjects\\CppLibraries\\Qt5\\5.15.2\\mingw81_64\\lib\\cmake\\")
find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED})
This is main.cpp:
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
qDebug() << "Hello World";
return QCoreApplication::exec();
}
These are the errors I'm getting:
CMakeFiles\jerseytraffic.dir/objects.a(main.cpp.obj): In function `main':
A:/CppProjects/jerseytraffic/main.cpp:5: undefined reference to `_imp___ZN16QCoreApplicationC1ERiPPci'
A:/CppProjects/jerseytraffic/main.cpp:6: undefined reference to `_imp___ZNK14QMessageLogger5debugEv'
A:/CppProjects/jerseytraffic/main.cpp:6: undefined reference to `_imp___ZN6QDebugD1Ev'
A:/CppProjects/jerseytraffic/main.cpp:7: undefined reference to `_imp___ZN16QCoreApplication4execEv'
A:/CppProjects/jerseytraffic/main.cpp:5: undefined reference to `_imp___ZN16QCoreApplicationD1Ev'
A:/CppProjects/jerseytraffic/main.cpp:6: undefined reference to `_imp___ZN6QDebugD1Ev'
A:/CppProjects/jerseytraffic/main.cpp:5: undefined reference to `_imp___ZN16QCoreApplicationD1Ev'
CMakeFiles\jerseytraffic.dir/objects.a(main.cpp.obj): In function `ZN7QString8fromUtf8EPKci':
A:/CppProjects/CppLibraries/Qt5/5.15.2/mingw81_64/include/QtCore/qstring.h:706: undefined reference to `_imp___ZN7QString15fromUtf8_helperEPKci'
CMakeFiles\jerseytraffic.dir/objects.a(main.cpp.obj): In function `ZN6QDebug10maybeSpaceEv':
A:/CppProjects/CppLibraries/Qt5/5.15.2/mingw81_64/include/QtCore/qdebug.h:129: undefined reference to `_imp___ZN11QTextStreamlsEc'
CMakeFiles\jerseytraffic.dir/objects.a(main.cpp.obj): In function `ZN6QDebuglsEPKc':
A:/CppProjects/CppLibraries/Qt5/5.15.2/mingw81_64/include/QtCore/qdebug.h:159: undefined reference to `_imp___ZN11QTextStreamlsERK7QString'
CMakeFiles\jerseytraffic.dir/objects.a(main.cpp.obj): In function `ZN15QTypedArrayDataItE10deallocateEP10QArrayData':
A:/CppProjects/CppLibraries/Qt5/5.15.2/mingw81_64/include/QtCore/qarraydata.h:239: undefined reference to `_imp___ZN10QArrayData10deallocateEPS_jj'
This is what I get in the CMake output when it reloads:
"A:\ProgramFiles\CLion 2020.3.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" A:\CppProjects\jerseytraffic
-- Configuring done
-- Generating done
-- Build files have been written to: A:/CppProjects/jerseytraffic/cmake-build-debug
[Finished]
One thing I have tried is modifying the cmake file by adding this around the add_executable line, but it did not make any changes:
find_package(Qt5 COMPONENTS Core REQUIRED)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} Qt5::Core)
Some other things that I have attempted include:
set(CMAKE_BUILD_TYPE "Debug -G \"MinGW Makefiles\"")
set(CMAKE_CXX_COMPILER "C:\\MinGW\\bin\\gcc.exe")
option(G "MinGW Makefiles")
I added this CMake option in Settings > Build, Execution, Deployment > CMake > Debug > CMake options: -G "MinGW Makefiles" %*
However, none of these seemed to fix the error.

QVTKWidget error when linking Qt with VTK

I'm having the famous linking error when trying to combine Qt and VTK. I've done all the steps of installing Qt with VTK correctly so I don't know what could possibly be wrong.
I'm using windows 8 with Qt5 and VTK 6.3 on visual studio.
Here is the error I get:
Drawing.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: __thiscall QVTKWidget::QVTKWidget(class QWidget *,class QFlags<enum Qt::WindowType>)" (__imp_??0QVTKWidget##QAE#PAVQWidget##V?$QFlags#W4WindowType#Qt#####Z) référencé dans la fonction "public: __thiscall Drawing::Drawing(void)" (??0Drawing##QAE#XZ)
1>Drawing.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: virtual __thiscall QVTKWidget::~QVTKWidget(void)" (__imp_??1QVTKWidget##UAE#XZ) référencé dans la fonction "public: __thiscall Drawing::~Drawing(void)" (??1Drawing##QAE#XZ)
And here is the code I use:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QVtk w;
w.show();
//start();
return a.exec();
}
I followed everything that was written here: Combining Qt 5.4.1 with vtk 6.2.0 (using CMake GUI 3.2.1) on windows but somehow I get this error.
Also, I've added: $(QTDIR)\lib to my additional libraries $(QTDIR)\include to my "other include directories" and the followings to my additional dependencies.
qtmaind.lib
C:\Users\Lonni\VTK\Build2012Qt\lib\MinSizeRel\QVTKWidgetPlugin.lib
Qt5Cored.lib
Qt5Guid.lib
Qt5Locationd.lib
Qt5Multimediad.lib
Qt5MultimediaWidgetsd.lib
Qt5Testd.lib
Qt5AxContainerd.lib
Qt5AxBased.lib
Qt5OpenGLd.lib
opengl32.lib
glu32.lib
Qt5Sensorsd.lib
Qt5Svgd.lib
Qt5Widgetsd.lib
EDIT:
I did not use CMake for the project as I have issues when using Cmake even with the small example provided on the wiki which gives the following error with the following CMakeLists.txt. NB: I use Visual Studio as a generator.
CMakeLists:
cmake_minimum_required(VERSION 2.8)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
PROJECT(RenderWindowNoUiFile)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED QUIET)
else()
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
file(GLOB UI_FILES *.ui)
file(GLOB QT_WRAP *.h)
file(GLOB CXX_FILES *.cxx)
if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")
qt5_wrap_ui(UISrcs ${UI_FILES} )
# CMAKE_AUTOMOC in ON so the MocHdrs will be automatically wrapped.
add_executable(RenderWindowNoUiFile MACOSX_BUNDLE
${CXX_FILES} ${UISrcs} ${QT_WRAP})
qt5_use_modules(RenderWindowNoUiFile Core Gui)
target_link_libraries(RenderWindowNoUiFile ${VTK_LIBRARIES})
else()
QT4_WRAP_UI(UISrcs ${UI_FILES})
QT4_WRAP_CPP(MOCSrcs ${QT_WRAP})
add_executable(RenderWindowNoUiFile MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${MOCSrcs})
if(VTK_LIBRARIES)
if(${VTK_VERSION} VERSION_LESS "6")
target_link_libraries(RenderWindowNoUiFile ${VTK_LIBRARIES} QVTK)
else()
target_link_libraries(RenderWindowNoUiFile ${VTK_LIBRARIES})
endif()
else()
target_link_libraries(RenderWindowNoUiFile vtkHybrid QVTK vtkViews ${QT_LIBRARIES})
endif()
endif()
Error:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/FindQt4.cmake:1326 (message):
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
CMakeLists.txt:18 (find_package)

qt odbc plugin build unsuccessful

I developed an application along the lines of the SQL Browser example provided with QT in the Demos and Examples section. My development machine is Windows XP (visual studio compiler was used) and the application works well on it. It is able to connect to an external database (MySQL), and I am able browse through tables. I used the QODBC driver for connections. However when I deploy the executable (with all required .dll files) in another computer without QT, it says that I need to provide for the database drivers. I read the documentation and realized that I need to build a PlugIn for QODBC drivers.
First I looked at an example Plugin (Echo Plugin Example) given at http://doc.qt.digia.com/4.6/tools-echoplugin.html. Then I followed the instructions in http://doc.qt.digia.com/4.6/sql-driver.html#qodbc.
cd %QTDIR%\src\plugins\sqldrivers\odbc
qmake odbc.pro
nmake
The above commands built qsqlodbc4.dll. However, I am not successful in developing a Plugin for my application. Here are my steps, and the compilation output:
Created project odbcplugin.pro (see script below) under directory /odbcpluginTest
TEMPLATE = subdirs
SUBDIRS = sqlbrowser \
odbc
CONFIG += release
# install
target.path = $$PWD
sources.path = $$PWD
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS
INSTALLS += target sources
Created subdirectories: /odbc, /sqlbrowser, /plugins
Inside the directroy /odbcpluginTest /odbc/
(i). Copied odbc.pro and suitably modified the paths and file names (for example, a file originally named as main.cpp has been renamed as mainODBC.cpp to avoid confusing with the file named main.cpp inside /sqlbrowser). See the scripts below:
TEMPLATE = lib
INCLUDEPATH += ../sqlbrowser
SOURCES = mainODBC.cpp
TARGET = qsqlodbc
DESTDIR = ../plugins
CONFIG += release
include(qsql_odbc.pri)
include(qsqldriverbase.pri)
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS
INSTALLS += target sources
(ii). The file odbcinterface.h that describes the plugin interface is included as a header in odbc.pro. However, it is actually placed inside the directory /sqlbrowser. Hence, the line INCLUDEPATH += ../sqlbrowser is included in the above script.
(iii). Also, copied all related project files (qsql_odbc.pri, qsqldriverbase.pri, qpluginbase.pri, qt_targets.pri). Suitably modified the paths in all project files (there may be mistakes in here).
(iv). The header (qsql_odbc.h) and source (qsql_odbc.cpp) files of qsql_odbc.pri have also been copied.
Inside the directory /odbcpluginTest /sqlbrowser/
(i). Copied sqlbrowser.pro and all related files.
(ii). Created the header file odbcinterface.h that describes the plugin interface (see below) and added it to the HEADERS in sqlbrowser.pro.
#ifndef ODBCINTERFACE_H
#define ODBCINTERFACE_H
#include <QString>
#include <QtSql/qsqldriver.h>
class OdbcInterface
{
public:
virtual ~OdbcInterface() {}
virtual QSqlDriver* create(const QString &) = 0;
virtual QStringList keys() const = 0;
};
QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(OdbcInterface,
"developed similar to com.trolltech.Plugin.EchoInterface/1.0");
QT_END_NAMESPACE
#endif // ODBCINTERFACE_H
iii. Also, modified the browser.h file by adding the lines
#include "odbcinterface.h"
private:
bool loadPlugin();
OdbcInterface *odbcInterface;
Public:
void TestCase1();
iv. Also, modified the browser.cpp file by adding the function definitions:
bool Browser::loadPlugin()
{
QDir pluginsDir(qApp->applicationDirPath());
#if defined(Q_OS_WIN)
pluginsDir.cdUp();
pluginsDir.cdUp();
#endif
pluginsDir.cd("plugins");
foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
QObject *pluginI = pluginLoader.instance();
if (pluginI) {
odbcInterface = qobject_cast<OdbcInterface *>(pluginI);
if (odbcInterface)
return true;
}
}
return false;
}
void Browser::TestCase1()
{
loadPlugin();
QStringList list;
list = odbcInterface->keys();
QMessageBox msgBox;
if(list.length() >0)
{
msgBox.setText("Test1 success");
}
else
{
msgBox.setText("Test1 failure");
}
msgBox.exec();
}
Testing:
In browser.cpp file, the constructor Browser::Browser(QWidget *parent) was modified by appending a call to void Browser::TestCase1()
Compile Output:
15:09:18: Running build steps for project odbcplugin...
15:09:18: Configuration unchanged, skipping qmake step.
15:09:18: Starting: "C:\QtSDK\QtCreator\bin\jom.exe"
cd sqlbrowser\ && C:\QtSDK\QtCreator\bin\jom.exe -nologo -j 2 -f Makefile
C:\QtSDK\QtCreator\bin\jom.exe -nologo -j 2 -f Makefile.Debug
cd odbc\ && C:\QtSDK\QtCreator\bin\jom.exe -nologo -j 2 -f Makefile
C:\QtSDK\QtCreator\bin\jom.exe -nologo -j 2 -f Makefile.Release
link /LIBPATH:"c:\QtSDK\Desktop\Qt\4.8.1\msvc2010\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /MANIFEST /MANIFESTFILE:"release\qsqlodbc.intermediate.manifest" /VERSION:4.81 /OUT:..\plugins\qsqlodbc4.dll #C:\DOCUME~1\SHAINE~1\LOCALS~1\Temp\qsqlodbc4.dll.5076.0.jom
Creating library ..\plugins\qsqlodbc4.lib and object ..\plugins\qsqlodbc4.exp
mainODBC.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QODBCDriverPlugin::metaObject(void)const " (?metaObject#QODBCDriverPlugin##UBEPBUQMetaObject##XZ)
mainODBC.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QODBCDriverPlugin::qt_metacast(char const *)" (?qt_metacast#QODBCDriverPlugin##UAEPAXPBD#Z)
mainODBC.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QODBCDriverPlugin::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QODBCDriverPlugin##UAEHW4Call#QMetaObject##HPAPAX#Z)
..\plugins\qsqlodbc4.dll : fatal error LNK1120: 3 unresolved externals
jom 1.0.6 - empower your cores
command failed with exit code 1120
command failed with exit code 2
command failed with exit code 2
15:09:19: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project odbcplugin (target: Desktop)
When executing build step 'Make'

OpenCV 2.4.6 with QT 5.1.0 Errors

I am trying to get OpenCv2.4.6 to work with QT5.1.0
I've followed this Guide so far Qt creator 5.0.1 with OpenCv 2.3.4 on windows
Unfortunatly after finishing trying out the sample Application(Display an Image using OpenCv in the QtCreator I get these Errors:
[Project-Path]\main.o:-1: In function `main':
[Project-Path]\main.cpp:8: error: undefined reference to `cv::imread(std::string const&, int)'
[Project-Path]\main.cpp:9: error: undefined reference to `cv::namedWindow(std::string const&, int)'
[Project-Path]\main.cpp:10: error: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
[Project-Path]\main.cpp:10: error: undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
[Project-Path]\main.cpp:11: error: undefined reference to `cv::waitKey(int)'
[Project Build Path Desktop Debug]\debug\main.o:-1: In function `ZN2cv3MatD1Ev':
[OpenCV/Install/include]\opencv2\core\mat.hpp:278: error: undefined reference to `cv::fastFree(void*)'
[Project Build Path Desktop Debug]\debug\main.o:-1: In function `ZN2cv3Mat7releaseEv':
[OpenCV/Install/include]\opencv2\core\mat.hpp:367: error: undefined reference to `cv::Mat::deallocate()'
collect2.exe:-1: error: error: ld returned 1 exit status
the "[]" Paths are my formatting and supposed to help keep track .
main.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main() {
// read an image
Mat image = imread("img.jpg");
namedWindow("My Image");
imshow("My Image", image);
waitKey(5000);
return 1;
}
myFirstOpenCVProject.pro
QT += core
QT -= gui
TARGET = myFirstOpenCVProject
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:/qt/OpenCV246_bin/install/include
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_core246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_highgui246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_imgproc246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_features2d246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_calib3d246.dll
Can you help me resolve this?
I can't find any solutions that apply to my case ...
-L is to add directories to the search path. The actual libs are added via -l. The correct line would be:
LIBS += -LC:/qt/OpenCV246_bin/install/lib -llopencv_core246 -llopencv_highgui246 ...
I think you are missing the static libs of opencv:
opencv_core246.lib
opencv_highgui246.lib
opencv_video246.lib
opencv_ml26d.lib
opencv_legacy246.lib
opencv_imgproc246.lib
opencv_whatever.lib
Don t know the pro commands very well. Maybe something like:
LIBS += -Lc:/blabla/opencv_imgproc246.lib

Qt 4.8.4 giving error in debug mode compilation

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
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

Resources