Windows VS2010 based QTCreator and 3rd party libraries SOLVED



  • I have Qt Creator 3.0.1 installed with the Qt 5.2.1 (MVSC 2010, 32 bit) libraries. I am new to Qt and it's been quite a few years since my C++ training so I am struggling in general. It's difficult to judge if I have a problem with my Qt project configuration or with the sample code I am trying to run. Right now I think it has to do with configuring the project correctly in Qt.

    The sample project is called HelloWorldQt.pro.

    @
    QT += widgets
    TEMPLATE = app
    TARGET = HelloWorldQt
    INCLUDEPATH += "C:/Program Files/MetaMAP/MetaMAP Engine 2 SDK/include"
    QMAKE_LIBDIR += "C:/Program Files/MetaMAP/MetaMAP Engine 2 SDK/libs"

    HEADERS +=
    ./helloworldqt.h
    "C:/Program Files/MetaMAP/MetaMAP Engine 2 SDK/include/MetaMAP/Engine/Controls/QtMapControl.hpp"

    SOURCES +=
    ./main.cpp
    ./helloworldqt.cpp

    FORMS +=
    ./helloworldqt.ui
    @

    When I try to build the project I get the following error:

    _dependent 'C:\Program' does not exist_

    What do I need to do to make this work?



  • DEPENDPATH += .

    add this entry to your .pro file



  • If you use e.g. message($$HEADERS), you'll see that there are no " anymore, so QMake thinks C:/Programm is a single argument as they are divided by spaces. ;)
    Using " instead of " for all three paths should solve the problem!

    Regards



  • I have made progress. I changed the paths to use environment variables. They contain spaces but I can now build the project but unsuccessfully. I am getting new error messages.

    The UI has a customwidget. It's in the file helloworldqt.ui file. Under the QMainWindow the centralWidget implements MetaMAP::Engine::QtMapControl. When I attempt to build the project I get three duplicate errors in ui_helloworldqt.h.

    Cannot open include file: 'MetaMAP/Engine/Controls/QtMapControl.hpp': No such file or directory

    I have double checked that the header file is there. If I open the UI file in a text editor the custom widget has the following:

    @
    <customwidget>
    <class>MetaMAP::Engine::QtMapControl</class>
    <extends>QWidget</extends>
    <header>MetaMAP/Engine/Controls/QtMapControl.hpp</header>
    <container>1</container>
    </customwidget>
    @

    Now what am I doing wrong?


  • Lifetime Qt Champion

    Hi,

    @
    QMAKE_LIBDIR += "C:/Program Files/MetaMAP/MetaMAP Engine 2 SDK/libs"
    @

    Should rather be:

    @
    LIBS += -L$$quote("C:/Program Files/MetaMAP/MetaMAP Engine 2 SDK/libs")
    @

    If this still doesn't work, it means that the spaces are wreaking havoc. Then the best thing to do is use the 8.3 naming.
    Something like

    @
    LIBS += -LC:/PROGRA~1/MetaMAP/METAMA~1
    @



  • Thanks for your input. Ok, so I might have a problem with the LIBDIR. However, it's the include path I have a problem with. Right? I ask this because you changed from QMAKE_LIBDIR to LIBS. Also you added the -L. I'll look that up in the manuals. That's great if that is necessary. But how will that resolve the problem with the includes?

    I changed to the 8.3 names with no change in the results.


  • Lifetime Qt Champion

    Why are you putting a header from that library in INCLUDES ? It's not part of your sources



  • I have gotten these problems resolved. The include you questioned was required to be able to use the 3rd party API. When I removed it from the .pro file I got hundreds of compile errors.

    I had to use the 8.3 short names for the project to compile. I understand. The world of desktop development is focused on the Linux environment and those doing Windows only development have to accommodate. I just had to get it figured out.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.