Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Libxml2 with Qt project under wine

    General and Desktop
    2
    6
    2127
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      heatblazer last edited by

      Hello, I am trying to include libxml from http://xmlsoft.org/downloads.html here, and use it in my qt project, I`ve placed the folder of libxml2 in my wine drive then in qt project I did:
      @
      win32 {
      message("*using settings for windows")
      INCLUDEPATH += "Z:\home\ilian\.wine\drive_c\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include"
      "Z:\home\ilian\.wine\drive_c\libxml2\include\libxml"

      LIBS += -L "Z:\\home\\ilian\\.wine\\drive_c\\Qt/Qt5.3.1\\Tools\\mingw482_32\\i686-w64-mingw32\\include\\windows.h" \
      "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\xmlversion.h" \
      "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\xmlexports.h" \
      "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\xmlreader.h" \
      "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\tree.h" \
      

      @

      It does not work the error is:
      @
      Z:\home\ilian.wine\drive_c\libxml2\include\libxml\xmlversion.h:13: error: libxml/xmlexports.h: No such file or directory
      #include <libxml/xmlexports.h>
      ^
      Z:\home\ilian.wine\drive_c\libxml2\include\libxml\xmlreader.h:13: error: libxml/xmlversion.h: No such file or directory
      #include <libxml/xmlversion.h>
      ^
      Z:\home\ilian.wine\drive_c\libxml2\include\libxml\tree.h:16: error: libxml/xmlversion.h: No such file or directory
      #include <libxml/xmlversion.h>
      ^
      @

      Can you tell me how to fix it?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Just remove libxml from "Z:\home\ilian\.wine\drive_c\libxml2\include\libxml"

        Also your LIBS line doesn't make sense. -L is to tell the linker where to look to find libraries so it should be followed by a folder.

        Note that with Qt you can (and should) use only forward slashes for path even on windows.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • H
          heatblazer last edited by

          Forward slashes... I noticed it but now that you mention, I`ll take note. I am learning Qt on the fly while working so I am treating myself as a noob yet :)
          [quote author="SGaist" date="1412848291"]Hi,

          Just remove libxml from "Z:\home\ilian\.wine\drive_c\libxml2\include\libxml"

          Also your LIBS line doesn't make sense. -L is to tell the linker where to look to find libraries so it should be followed by a folder.

          Note that with Qt you can (and should) use only forward slashes for path even on windows.[/quote]

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Did you got the rest working ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • H
              heatblazer last edited by

              It`s perfect for linux compile/run but for windows I still get the undefined references. Here is the .pro file:
              @
              win32 {
              message("*using settings for windows")
              INCLUDEPATH += "Z:\home\ilian\.wine\drive_c\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include"
              INCLUDEPATH += "Z:\home\ilian\.wine\drive_c\libxml2\include"
              }
              @

              I know about the slashes, I just keep these because the INCLUDEPATH for mingw... windows.h is working ( the first one ).

              The file I am using libxml is as follows ( it`s small so I am c/p the whole):
              @
              #ifndef XMLTEST_H
              #define XMLTEST_H
              #ifdef gnu_linux
              #include <libxml2/libxml/parser.h>
              #include <libxml2/libxml/tree.h>
              #include <libxml2/libxml/xmlversion.h>
              #include <libxml2/libxml/xmlexports.h>
              #include <libxml2/libxml/xmlreader.h>
              #include <stdio.h>
              #else
              #include <libxml2/include/libxml/parser.h>
              #include <libxml2/include/libxml/tree.h>
              #include <libxml2/include/libxml/xmlversion.h>
              #include <libxml2/include/libxml/xmlexports.h>
              #include <libxml2/include/libxml/xmlreader.h>
              #include <stdio.h>
              #endif

              #include "DList.h"
              /* read the XML file from args then return it as DList,
              call DList passToDaemonArgvs() to return char** /
              DList
              main_xml(int, char**);

              void parseDirectoryAddToList(DList*, xmlDocPtr, xmlNodePtr);

              #endif // XMLTEST_H
              @
              Still can`t get why this is not working... the windows.h was success including and building, but libxml?

              [quote author="SGaist" date="1412980151"]Did you got the rest working ?[/quote]

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                From your win32 scope I don't see anywhere where you give the path to find the libxml2 libraries.
                You need to add something like

                @LIBS += -L/Path/to/where/libxml2/windows/libfiles/can/be/found@

                or using double backslashes

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post