Important: Please read the Qt Code of Conduct -

Qt Creator suddenly can't find QtXml

  • Hello all,

    I'm new to Qt in general, and Qt Creator in particular, so please excuse me if this is the wrong forum.

    I'm developing an app that parses an Xml document. To that end, I've been using the QtXml library, and until today all has been fine. Today, however, Qt Creator keeps giving me "Cannot open include file: 'QtXml': No such file or directory". Pardon my language, but, WTF? It started happening after I included a new custom library to the test app; but, the error flags a line in a library that (until today) has worked fine, and the new library makes no reference to QtXml. Google has been utterly useless.

    I'm no stranger to the weird compiler errors C++ code can produce; but, I am absolutely flummoxed by this one. I would welcome any insight from the community or, failing that any hint as to how I can remove the library that (apparently) is causing the problem.

    Thanks in advance everyone.

  • I should also add that Tools->Locate has no problem finding the header file.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you share your .pro file ?

  • @SGaist

    Hi and thanks for responding. There's no need now; I figured out a solution last night. I just recreated the project. I think the problem stemmed from moving the project between machines (though, as near as I can tell, both dev. environments are the same). Even so, if you're curious, here's the .pro file:

    QT += core
    QT += xml
    QT -= gui

    TARGET = TestDicomDictionary
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../build-DicomDictionary-Desktop_Qt_5_5_1_MSVC2012_32bit-Debug/release/ -lDicomDictionary
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../build-DicomDictionary-Desktop_Qt_5_5_1_MSVC2012_32bit-Debug/debug/ -lDicomDictionary

    INCLUDEPATH += $$PWD/../DicomDictionary
    DEPENDPATH += $$PWD/../DicomDictionary

    I'd appreciate any additional insight you can provide. Thanks again.

  • Lifetime Qt Champion

    You should avoid hardcoding path like that in your .pro file. You should rather use OUT_PWD

Log in to reply