[Qt-interest] Compiling App on Visual Studio 2008

Felipe Magno de Almeida felipe.m.almeida at gmail.com
Tue Aug 30 14:20:04 CEST 2011


Hi Hildebrando,

The problem is probably because you aren't exporting any symbols. And
Visual Studio doesn't
generate any .lib then instead of a empty one. Try using
__declspec(dllexport) directives
or a .def file.

On Tue, Aug 30, 2011 at 9:15 AM, Hildebrando Trannin <htrannin at gmail.com> wrote:
> Hi Alex,
> thanks for the answer. I already tried to compile each library individually,
> but it didn`t work.
> I`d like to know if there is any configuration that I have to do in Qt
> project files (.pro) to generate both dll and lib files in compilation. I
> put my .pro files below.
> commons.pri
> CONFIG *= debug_and_release
> OBJECTS_DIR = .obj
> UI_DIR = .ui
> MOC_DIR = .moc
> DESTDIR = target
> linux {
> DEFINES *= LINUX LEMON
> }
> win32 {
> DEFINES *= WIN LEMON
> }
> CONFIG(debug, debug|release) {
>   TARGET = $${TARGET}_d
> }
> CONFIG(lib1) {
>   INCLUDEPATH *= $${PWD}/chulipa-htg/src
>   LIBS *= -L$${PWD}/chulipa-htg/target
>   CONFIG(debug, debug|release) {
>     LIBS *= -lchulipa-htg_d
>   } else {
>     LIBS *= -lchulipa-htg
>   }
> }
> CONFIG(lemon) {
>   INCLUDEPATH *= $${PWD}/dependencies/lemon-1.2.1 \
> $${PWD}/dependencies/lemon-1.2.1/target
>
>   linux {
> LIBS *= -L$${PWD}/dependencies/lemon-1.2.1/target/libs -lemon
>   }
>   win32 {
> LIBS *= -L$${PWD}/dependencies/lemon-1.2.1/target/libs -llemon
>   }
>   CONFIG(QtLua) {
>     INCLUDEPATH *= $${PWD}/dependencies/libqtlua/src
>     LIBS *= -L$${PWD}/dependencies/libqtlua/target/libs -lqtlua
>   }
> }
>
> lib1:
> TEMPLATE = lib
> QT += core \
>     gui \
>     xmlpatterns
> CONFIG *= lemon
> HEADERS += #h files
> SOURCES += #cpp files
> RESOURCES += queries/queries.qrc
> include(../commons.pri)
> lib2:
> TEMPLATE = lib
> QT += core \
>     xmlpatterns \
>     xml \
>     phonon \
>     network
> CONFIG *= lemon \
>     htg \
>     QtLua
> HEADERS += #h files
> SOURCES += #cpp files
> RESOURCES += resources/core-resources.qrc
> include(../commons.pri)
>
> Thanks,
>   Hildebrando
> On Fri, Aug 26, 2011 at 10:19 PM, Malyushytsky, Alex <alex at wai.com> wrote:
>>
>> If we are talking about dlls,
>>
>> dll file contains the code which has to be present at run time,
>>
>> lib file is description of the interface which you need for linking.
>>
>> Normally both files are built (might be in different folders) when you
>> build dll.
>>
>>
>>
>> I am not sure what happens in your case, I can only suggest you to check
>> project dependencies.
>>
>> If they are specified correctly, lib1 should be built first.
>>
>> Also instead of building whole solution, you can try to build projects one
>> by one manually.
>>
>> Build lib1 first
>>
>> If success build lib2.
>>
>> If it does not work find why.
>>
>> Mostly likely in this case it does not refer to proper location.
>>
>>
>>
>> Regards,
>>
>>    Alex
>>
>>
>>
>>
>>
>> From: qt-interest-bounces+alex=wai.com at qt.nokia.com
>> [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of
>> Hildebrando Trannin
>> Sent: Thursday, August 25, 2011 1:01 PM
>> To: qt-interest at qt.nokia.com
>> Subject: [Qt-interest] Compiling App on Visual Studio 2008
>>
>>
>>
>> Hi,
>>
>>
>>
>> I tried to compile my Qt application on Visual Studio 2008.
>>
>>
>>
>> I used my .pro file to generate the makefile and then executed it with
>> nmake. I have 3 libraries projects and 1 app project. The dependency are as
>> follow: lib2 depends on lib1; lib3 depends on lib1 and lib2; app depends on
>> lib3, lib2 and lib1.
>>
>>
>>
>> The first library compiled successful, but I got an error in the second
>> one when it tries to link to the first library. The error is: fatal error
>> LNK1181: cannot open input file XXXX.lib
>>
>>
>>
>> I think that it's trying to use the .lib file, but the compilation
>> generates only the .dll file.
>>
>>
>>
>> How can I generate a makefile to the second library that uses the dll file
>> of the first one? The compilation on Linux and MingW worked without any
>> problem.
>>
>>
>>
>> Thanks,
>>
>>    Hildebrando
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------------------------------------
>> Weidlinger Associates, Inc. made the following annotations.
>>
>> “This message and any attachments are solely for the intended recipient
>> and may contain confidential or privileged information. If you are not the
>> intended recipient, any disclosure, copying, use, or distribution of the
>> information included in this message and any attachments is prohibited. If
>> you have received this communication in error, please notify us by reply
>> e-mail and immediately and permanently delete this message and any
>> attachments. Thank you.”
>>
>> “Please consider our environment before printing this email.”
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>



-- 
Felipe Magno de Almeida



More information about the Qt-interest-old mailing list