Solved Building a standalone executable (Windows)
-
@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.
-
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. -
@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...
-
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:
I have absolutely no idea what all that nonsense is...anyone have a clue?Thanks...
-
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.
-
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?? :)
-
@jonb said in Building a standalone executable (Windows):
persiflage
-
@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? ;-)
-
@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.
-
pusillanimous ... insouciant
in contrast to persiflage, I actually had to look those to two up!