Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtCreator from Linux to Windows 10

QtCreator from Linux to Windows 10

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 929 Views
  • 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.
  • K Offline
    K Offline
    Kezin99
    wrote on last edited by
    #1

    Hello, I would like to have a QtCreator code go from Linux to Windows 10. However, there are some libraries that are Linux specific that are in the code: <ifaddrs.h>, <netinet/in.h>, and <arpa/inet.h>. Is there a way to resolve this issue?

    JonBJ 1 Reply Last reply
    0
    • K Kezin99

      @JonB Yes, in my code sorry. The code that I have written was originally written in Linux and is using headers that is Linux specific. However, I am trying to port it to Windows 10, and am having difficulty because of the usage of Linux-specific libraries. The code in itself is written in C++

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #7

      @Kezin99
      So Qt Creator cannot help you much in this case. It's an IDE/editor like everything else. You have to change to make things work under Windows if you have Linux-specific code.

      If you are writing your own Qt code, this does not happen, as the Qt libraries/headers abstract away the difference between platforms. Usually you don't write code which includes the headers you mention, you use Qt equivalents instead. If you cannot/do not wish to rewrite to work that way, you will have to find your own platform-specific equivalents. Or, as @Psnarf said, you could find another abstract layer like Posix and rewrite for that.

      1 Reply Last reply
      2
      • K Kezin99

        Hello, I would like to have a QtCreator code go from Linux to Windows 10. However, there are some libraries that are Linux specific that are in the code: <ifaddrs.h>, <netinet/in.h>, and <arpa/inet.h>. Is there a way to resolve this issue?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @Kezin99
        Qt code only uses common headers/libraries. If your own code uses Linux-specific headers, for some reason (do you really need them?), then don't include them (put them inside a suitable #if/#ifdef/#ifndef) if compiling for Windows.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kezin99
          wrote on last edited by
          #3

          When not including these header files, there are several compiler errors indicating that some functions are unavailable. For example, ifaddrs.h has the function getifaddrs(), which is called in the code.

          JonBJ 1 Reply Last reply
          0
          • K Kezin99

            When not including these header files, there are several compiler errors indicating that some functions are unavailable. For example, ifaddrs.h has the function getifaddrs(), which is called in the code.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @Kezin99
            Called in what code?? Your code? Then don't call it if it's not going to be available! If you mean somehow it's in Qt-supplied code, then that should not be trying to include things which do not exist on specific platforms. You need to explain what your issue is.

            K 1 Reply Last reply
            0
            • JonBJ JonB

              @Kezin99
              Called in what code?? Your code? Then don't call it if it's not going to be available! If you mean somehow it's in Qt-supplied code, then that should not be trying to include things which do not exist on specific platforms. You need to explain what your issue is.

              K Offline
              K Offline
              Kezin99
              wrote on last edited by
              #5

              @JonB Yes, in my code sorry. The code that I have written was originally written in Linux and is using headers that is Linux specific. However, I am trying to port it to Windows 10, and am having difficulty because of the usage of Linux-specific libraries. The code in itself is written in C++

              PsnarfP JonBJ 2 Replies Last reply
              0
              • K Kezin99

                @JonB Yes, in my code sorry. The code that I have written was originally written in Linux and is using headers that is Linux specific. However, I am trying to port it to Windows 10, and am having difficulty because of the usage of Linux-specific libraries. The code in itself is written in C++

                PsnarfP Offline
                PsnarfP Offline
                Psnarf
                wrote on last edited by
                #6

                @Kezin99
                Why not use Posix functions, which should work in both Linux and Windows? For example, getaddrinfo() instead of getifaddrs(). See what data the Linux function provides and search MSDN documentation for a function that provides that data.

                1 Reply Last reply
                3
                • K Kezin99

                  @JonB Yes, in my code sorry. The code that I have written was originally written in Linux and is using headers that is Linux specific. However, I am trying to port it to Windows 10, and am having difficulty because of the usage of Linux-specific libraries. The code in itself is written in C++

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #7

                  @Kezin99
                  So Qt Creator cannot help you much in this case. It's an IDE/editor like everything else. You have to change to make things work under Windows if you have Linux-specific code.

                  If you are writing your own Qt code, this does not happen, as the Qt libraries/headers abstract away the difference between platforms. Usually you don't write code which includes the headers you mention, you use Qt equivalents instead. If you cannot/do not wish to rewrite to work that way, you will have to find your own platform-specific equivalents. Or, as @Psnarf said, you could find another abstract layer like Posix and rewrite for that.

                  1 Reply Last reply
                  2

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved