Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building a standalone executable (Windows)
Forum Updated to NodeBB v4.3 + New Features

Building a standalone executable (Windows)

Scheduled Pinned Locked Moved Solved Installation and Deployment
24 Posts 6 Posters 3.5k Views 3 Watching
  • 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.
  • mranger90M mranger90

    @mzimmers said in Building a standalone executable (Windows):

    try:

    LIBS += -l"C:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib"

    That's a lower-case ell in front of the library path/name

    mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #10

    @mranger90 yeah, I already tried that...despite what the QMake page says, Qt doesn't seem to like the Linux format of specifying libraries:

    :-1: error: cannot find -lC:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib
    

    Trying this, though, wasn't without value, as it indicates that I am indeed including the library in my build.

    I wonder if this is some weird problem with name decoration...?

    JonBJ 1 Reply Last reply
    0
    • mzimmersM mzimmers

      @mranger90 yeah, I already tried that...despite what the QMake page says, Qt doesn't seem to like the Linux format of specifying libraries:

      :-1: error: cannot find -lC:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib
      

      Trying this, though, wasn't without value, as it indicates that I am indeed including the library in my build.

      I wonder if this is some weird problem with name decoration...?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #11

      @mzimmers
      I;m totally jumping in here, but I don't think you want the leading -l under Windows, only the path....

      1 Reply Last reply
      0
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on last edited by mranger90
        #12

        Did you try:

        LIBS += -L"C:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release" -l expat_static
        

        to split the search path and library name into separate directives ?

        1 Reply Last reply
        0
        • mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #13

          @jonb according to the docs, it should work (at least that's how I interpret it), but it sure doesn't seem to.

          mranger: I think using the "normal" win32 format is working for me; I used it with my former version of Expat. I believe the problem lies elsewhere -- perhaps I didn't build the library correctly, though it is distributed as a near-turnkey VS solution.

          JonBJ 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @jonb according to the docs, it should work (at least that's how I interpret it), but it sure doesn't seem to.

            mranger: I think using the "normal" win32 format is working for me; I used it with my former version of Expat. I believe the problem lies elsewhere -- perhaps I didn't build the library correctly, though it is distributed as a near-turnkey VS solution.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by JonB
            #14

            @mzimmers
            That docs page is the one I looked at. The examples for win32:LIBS do not have the leading -l. The error message

            cannot find -lC:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib
            

            shows it is looking for a filepath -lC.... Just a guess.

            mzimmersM 1 Reply Last reply
            0
            • JonBJ JonB

              @mzimmers
              That docs page is the one I looked at. The examples for win32:LIBS do not have the leading -l. The error message

              cannot find -lC:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib
              

              shows it is looking for a filepath -lC.... Just a guess.

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #15

              @jonb the examples don't use the -L/-l, but the text suggests (to me, anyway) that they should work:

              If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker).

              Anyway, it doesn't really matter, because I'm using this, and it works:

              LIBS += "C:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib"
              

              At least it worked with the pre-built version 2.2.5; I still don't know what's going wrong here.

              JonBJ 1 Reply Last reply
              1
              • mzimmersM mzimmers

                @jonb the examples don't use the -L/-l, but the text suggests (to me, anyway) that they should work:

                If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker).

                Anyway, it doesn't really matter, because I'm using this, and it works:

                LIBS += "C:/Users/MZimmers/apps_desktop/libs/libexpat-R_2_2_7/libexpat-R_2_2_7/expat/win32/bin/Release/expat_static.lib"
                

                At least it worked with the pre-built version 2.2.5; I still don't know what's going wrong here.

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by JonB
                #16

                @mzimmers

                If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker).

                You're right, I missed that. Note it also says:

                The library must exist for qmake to find the directory where a -l lib is located.

                which sounds like just what that error message is indicating is happening (i.e. failing to find the library)?

                I did say I was jumping in! What you have on your LIBS += line looks to me as though it should work.

                mzimmersM 1 Reply Last reply
                0
                • JonBJ JonB

                  @mzimmers

                  If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker).

                  You're right, I missed that. Note it also says:

                  The library must exist for qmake to find the directory where a -l lib is located.

                  which sounds like just what that error message is indicating is happening (i.e. failing to find the library)?

                  I did say I was jumping in! What you have on your LIBS += line looks to me as though it should work.

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #17

                  @jonb I think if it couldn't find the library, I'd get a different error message. Somehow, I've screwed up the build of the lib...no idea how, but I might just start from scratch. I'll report back when I have something...

                  1 Reply Last reply
                  0
                  • mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #18

                    Well, this continues to get more interesting: I edited my project file, right-clicked and started the Add Library wizard. When I was finished, I had some stuff added that looked like this:

                    win32: LIBS += -L$$PWD/../../libs/libexpat-R_2_2_7/expat/win32/bin/Release/ -llibexpatMT
                    
                    INCLUDEPATH += $$PWD/../../libs/libexpat-R_2_2_7/expat/win32/bin/Release
                    DEPENDPATH += $$PWD/../../libs/libexpat-R_2_2_7/expat/win32/bin/Release
                    
                    win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../libs/libexpat-R_2_2_7/expat/win32/bin/Release/libexpatMT.lib
                    else:win32-g++: PRE_TARGETDEPS += $$PWD/../../libs/libexpat-R_2_2_7/expat/win32/bin/Release/liblibexpatMT.a
                    

                    I had to comment out the else, as it (understandably) didn't know what to do with an .a file. I got an error message to the effect that it was skipping over my "incompatible" library in its search for -llibexpatMT. I realized that when I rebuilt the Expat library from scratch, I didn't specify a 64-bit platform. (I guess this was Creator's way of telling me this.)

                    So, I fixed that, rebuilt and now I get THESE errors:
                    0_1565906882086_expat.png
                    I have absolutely no idea what all that nonsense is...anyone have a clue?

                    Thanks...

                    1 Reply Last reply
                    0
                    • mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #19

                      Found the problem...turns out those symbols are looked for when this compiler switch is enabled, which it was in the VS project. I turned it off, and now the project builds...and runs when removed from the build directory, so I believe I have my long-coveted standalone image.

                      For those following along at home, I think you can ignore most of the above persiflage regarding the syntax for Windows libraries. What matters is that everything is of the same architecture: your application, your version of Qt, and any 3rd-party libraries you may use.

                      Thanks to all who looked at this.

                      JonBJ 1 Reply Last reply
                      3
                      • mzimmersM mzimmers

                        Found the problem...turns out those symbols are looked for when this compiler switch is enabled, which it was in the VS project. I turned it off, and now the project builds...and runs when removed from the build directory, so I believe I have my long-coveted standalone image.

                        For those following along at home, I think you can ignore most of the above persiflage regarding the syntax for Windows libraries. What matters is that everything is of the same architecture: your application, your version of Qt, and any 3rd-party libraries you may use.

                        Thanks to all who looked at this.

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #20

                        @mzimmers

                        persiflage

                        Incredible! I consider myself to have a good command of the English language, and I have never heard of that word! Nor come across it in day-to-day typical conversation. Last used by Shakespeare?? :)

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #21

                          @jonb said in Building a standalone executable (Windows):

                          persiflage

                          It's a french word from the XVIIIth century

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

                          JonBJ 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            @jonb said in Building a standalone executable (Windows):

                            persiflage

                            It's a french word from the XVIIIth century

                            JonBJ Online
                            JonBJ Online
                            JonB
                            wrote on last edited by JonB
                            #22

                            @sgaist
                            Indeed, and for my sins I studied 18th century French literature (Racine, Moliere anyone?)!

                            But who the heck uses an 18th century French word in the middle of a tech post on an (English) Qt forum? ;-)

                            mzimmersM 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @sgaist
                              Indeed, and for my sins I studied 18th century French literature (Racine, Moliere anyone?)!

                              But who the heck uses an 18th century French word in the middle of a tech post on an (English) Qt forum? ;-)

                              mzimmersM Offline
                              mzimmersM Offline
                              mzimmers
                              wrote on last edited by
                              #23

                              @jonb heh...well, I may not be much of a programmer, but I do know a lot of words, and I enjoy using them.
                              A couple of weeks ago, I was playing a round of golf. I went out as a single, so I didn't know the people I was playing with. After leaving a putt well short, I said, "well that was rather pusillanimous of me." Getting a blank look from my co-players, I explained "it's the opposite of insouciant."

                              That didn't seem to help much.

                              J.HilkJ 1 Reply Last reply
                              3
                              • mzimmersM mzimmers

                                @jonb heh...well, I may not be much of a programmer, but I do know a lot of words, and I enjoy using them.
                                A couple of weeks ago, I was playing a round of golf. I went out as a single, so I didn't know the people I was playing with. After leaving a putt well short, I said, "well that was rather pusillanimous of me." Getting a blank look from my co-players, I explained "it's the opposite of insouciant."

                                That didn't seem to help much.

                                J.HilkJ Offline
                                J.HilkJ Offline
                                J.Hilk
                                Moderators
                                wrote on last edited by
                                #24

                                @mzimmers

                                pusillanimous ... insouciant

                                in contrast to persiflage, I actually had to look those to two up!


                                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                Q: What's that?
                                A: It's blue light.
                                Q: What does it do?
                                A: It turns blue.

                                1 Reply Last reply
                                1

                                • Login

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