[Qt-interest] Error compiling QtSingleApplication-2.6 as Visual Studio 2008 project
Marc Cals
cpmarc at gmail.com
Thu Dec 17 18:58:35 CET 2009
Hello,
We are trying to compile QtSingleApplication library as a Visual Studio 2008
Solution to generate an external dll to link it dynamically at our project,
we have compile the QtSingleApplication library using "qmake" and "nmake"
commands succesfully, but if we try to compile as a Visual Studio Solution
we have some problems.
To compile it as Visual Studio Solution we use the command "qmake -tp vc
-r", executing this command at root project we get the first error :
"WARNING: Ignored (not found) C:/qtsingleapplication-2.6-
opensource/buildlib\QtSolutions_SingleApplication_2.6.vcproj"
The problem is that the vcproj file is generated with a wrong name, it's
generated with a dash '-' separating the version of qt singleapplication
"QtSolutions_SingleApplication-2.6.vcproj", indeed of underscore "_" . We
solved this problem editing the file common.pri changing the line
QTSINGLEAPPLICATION_LIBNAME =
$$qtLibraryTarget(QtSolutions_SingleApplication-2.6) line for
QTSINGLEAPPLICATION_LIBNAME =
$$qtLibraryTarget(QtSolutions_SingleApplication_2.6). (changing the dash
between ...SingleApplication-2.6 for an underscore ...SingleApplication_2.6)
After this change the Visual Studio Solution is generated correctly with
"qmake -tp vc -r", but when we try compile the solution we get severals
errors :
1>..\src\qtsingleapplication.cpp(143) : warning C4273:
'QtSingleApplication::sysInit' : inconsistent dll linkage
1>
c:\qtsingleapplication-2.6-opensource\src\qtsingleapplication.h(102) : see
previous definition of 'sysInit'
1>..\src\qtsingleapplication.cpp(161) : warning C4273:
'QtSingleApplication::QtSingleApplication' : inconsistent dll linkage
1>
c:\qtsingleapplication-2.6-opensource\src\qtsingleapplication.h(73) : see
previous definition of '{ctor}'
1>..\src\qtsingleapplication.cpp(174) : warning C4273:
'QtSingleApplication::QtSingleApplication' : inconsistent dll linkage
1>
c:\qtsingleapplication-2.6-opensource\src\qtsingleapplication.h(74) : see
previous definition of '{ctor}'
1>..\src\qtsingleapplication.cpp(186) : warning C4273:
'QtSingleApplication::QtSingleApplication' : inconsistent dll linkage
1>
c:\qtsingleapplication-2.6-opensource\src\qtsingleapplication.h(75) : see
previous definition of '{ctor}'
1>..\src\qtsingleapplication.cpp(245) : warning C4273:
'QtSingleApplication::isRunning' : inconsistent dll linkage
1>
c:\qtsingleapplication-2.6-opensource\src\qtsingleapplication.h(82) : see
previous definition of 'isRunning'
1>..\src\qtsingleapplication.cpp(264) : warning C4273:
'QtSingleApplication::sendMessage' : inconsistent dll linkage
1>
c:\qtsingleapplication-2.6-opensource\src\qtsingleapplication.h(93) : see
previous definition of 'sendMessage'
1>..\src\qtsingleapplication.cpp(274) : warning C4273:
'QtSingleApplication::id' : inconsistent dll linkage
....................
Investigating we see that the problem is in one of the Preprocessors flag
(open QtSingleApplication project properties, at Configuration Properties->
C/C++-> Preprocesors) of the Visual Studio Solution. It uses
"QT_QTSINGLEAPPLICATION_IMPORT" flag, defining the dll as a dll import in
the solution, when it has to be an export dll using flag
QT_QTSINGLEAPPLICATION_EXPORT indeed of QT_QTSINGLEAPPLICATION_IMPORT. If we
manually change this flag then the solution compile correctly.
This flag QT_QTSINGLEAPPLICATION_EXPORT is defined in
src/qtsingleapplication.pri file
win32 {
contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES +=
QT_QTSINGLEAPPLICATION_EXPORT
else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT
}
The problem is in contains(TEMPLATE, lib) command if we elimate it, then
the solution uses QT_QTSINGLEAPPLICATION_EXPORT flag and It's generated as a
dll export, it seems for a unknow reason for us that TEMPLATE not contains
lib, but if you look at buildlib/buildlib.pro at the first line defines
TEMPLATE=lib.
Are These two errors a qmake bug ? Or are we doing something wrong
generating the Visual Studio Solution ?
Thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091217/ec196001/attachment.html
More information about the Qt-interest-old
mailing list