Compilation Error 3
-
I am developing a Qt dll project (SampleCOMDll.dll) with a library project named "samplelibrary" in Qt 5.2.1. using Qt Creator 3.0.1.
On compilation I am getting a errors (Error 3).How do I fix this? Do I need any other pack to be installed.
Project Details:
I created an empty dll project named "SampleCOMDll" and a then a library project named "samplelibrary" (Template: Library --> C++ Library --> Shared Library)
And I have an created an object for "samplelibrary" in "SampleCOMDll".On compilation of "SampleCOMDll" project, my application is giving a compile Error 3 without generating the idl file.
But "SampleCOMDll.dll" is getting generated. I am not able to use the .dll in my application. (Error details are listed below).How do I fix this? Do I need any other pack to be installed?
Also I observed that if I do not craete any object of "samplelibrary" in "SampleCOMDll", there are no compilation errors and idl is generated.
P.S: I am using installation from pack "qt-opensource-windows-x86-mingw48_opengl-5.2.1.exe" and I have Microsoft Visual Studio 2008 installed.
Compile output has the following errors.
bq. C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\idc.exe debug\SampleCOMDll.dll /idl debug/SampleCOMDll.idl -version 1.0
debug\SampleCOMDll.idl
Couldn't load library file debug\SampleCOMDll.dll
Class has no metaobject information (error in debug\SampleCOMDll.dll)!
Makefile.Debug:78: recipe for target 'debug\SampleCOMDll.dll' failed
mingw32-make[1]: [debug\SampleCOMDll.dll] Error 3 (ignored)I am giving my Project Details below:
Project "SampleCOMDll.pro" File:
@TEMPLATE = lib
TARGET = SampleCOMDllCONFIG += warn_off dll
QT += axcontainer
QT += axserver
QT += widgets
QT += opengl
QT += core
RC_FILE = SampleCOMDll.rc
DEF_FILE = SampleCOMDll.def
HEADERS +=
sampleclass.h
SOURCES +=
sampleclass.cppwin32: LIBS += -L$$PWD/../Bin/debug/ -lSampleLibrary
INCLUDEPATH += $$PWD/../Bin/debug
DEPENDPATH += $$PWD/../Bin/debug@
Project "samplelibrary" File:
@QT += widgets opengl
TARGET = SampleLibrary
TEMPLATE = libDEFINES += SAMPLELIBRARY_LIBRARY
SOURCES += samplelibrary.cpp
HEADERS += samplelibrary.h
samplelibrary_global.hunix {
target.path = /usr/lib
INSTALLS += target
}@ -
MinGW and MSVC compilers are not compatible, you should use the same compiler for compiling both projects (I am not sure whether you are doing that or not).
-
Thanks for the reply.
I am actually using Qt Creator 3.0.1 to compile both the projects. I hope QT Creator IDE uses MinGW compilers. Am I correct?
-
Most probably you are. You can check it in your project settings ("Project" panel on the keft hand side of Qt Creator window).
-
I noticed the compile is trying to use a dll. If you are using qt creator and mingw then DLLs would be named as .so files and libs would be .a. So if it is trying to use a DLL inside of a mingw project it won't work, and would indeed say it couldn't find any symbols.
Looks like what sierdzio said is happening and you are mixing 2 different compilers/binaries.