Nominate our 2022 Qt Champions!

libxml2 in qt with wingw32 library adding problem

  • Hello,

    I'm trying to develop some program that needs to read xml files. I want to develop it using libxm because I need to cross-compile it in a Embedded Linux system latter.

    I use this precompiled library:

    I want to execute this io example:

    I want to execute it, but It doesn't work properly and I have this return:

    Starting C:\workspace\build\build-libxml_helloWorld-Desktop_Qt_5_3_MinGW_32bit-Release\release\libxml_helloWorld.exe... C:\workspace\build\build-libxml_helloWorld-Desktop_Qt_5_3_MinGW_32bit-Release\release\libxml_helloWorld.exe exited with code -1073741515

    I have .pro file like this:

    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt
    SOURCES += main.cpp
    win32: LIBS += -L$$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/ -llibxml2
    INCLUDEPATH += $$PWD/../libxml_win32/libxml2-2.7.8.win32/include
    DEPENDPATH += $$PWD/../libxml_win32/libxml2-2.7.8.win32/include
    win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/libxml2.lib
    else:win32-g++: PRE_TARGETDEPS += $$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/libxml2_a.lib
    OTHER_FILES += \
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/ -llibxml2_a
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/ -llibxml2_a
    INCLUDEPATH += $$PWD/../libxml_win32/libxml2-2.7.8.win32/include
    DEPENDPATH += $$PWD/../libxml_win32/libxml2-2.7.8.win32/include
    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/libxml2_a.lib
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/libxml2_a.lib
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/libxml2_a.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/libxml2_a.lib
    win32: LIBS += -L$$PWD/../libxml_win32/libxml2-2.7.8.win32/lib/ -llibxml2_a_dll
    INCLUDEPATH += $$PWD/../libxml_win32/libxml2-2.7.8.win32/include
    DEPENDPATH += $$PWD/../libxml_win32/libxml2-2.7.8.win32/include

    i think i have some problems or bad adding of the libs.
    Can someone give me some tips or help? I don't know how to put it runing :S

    thanks in advance,

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have the folder containing your libxml2 dll in your PATH environment variable ? If not, go the Project tab, run settings, and modify it there.

  • @SGaist Hello and thanks,

    Yes, I do but it has the same error.

    I have just realized that It doesn't execute the main function, the problem comes when I add the header files of the libxml2 libraries ... why it could be? some problems when linking header files and libraries? :S

    Thanks for all!

  • Lifetime Qt Champion

    Do you mean that if you don't link to libxml2 everything is good and once you link then not anymore ?

  • @SGaist Yes, exactly. That means that the precompiled library doesn't work with the qt winmg32? So... I need to compile all the libmx2 to use it with qt? :S


  • Lifetime Qt Champion

    Sorry, I've mixed runtime and linking error. Do you know what version of MinGW was used to compile your pre-built libxml2 ?

  • No, I can't find the version . Maybe I can't use it because was for windows xp and I am using windows 7... I don't know, I give up. :D

    I also was trying to compile libxml2 (libxml++ for using with c++) like library to qt but it is hard.

    I will use QtXmlReader for Windows and then, I will use libxml in embedded linux. I think it will be the best solution.

    Thanks for your time,

  • Lifetime Qt Champion

    If you can implement it with QXmlReader then why do a second implementation with libxml2 ?