problem with static building
hi,
i built a simple GUI that uses another console application.and i embeded this console application in my GUI exe file using resources.and i built the program using shared linking and the program worked fine.but when i built my program using static linking , the program runs well but when it tries to run the console app, it failes.
what is the problem?
Re: problem with static building
Read your post and then think about how we should help you with this few informations.
Re: problem with static building
i used this xml code to add the console app into my resource file
Code:
<file>Resources/upx.exe</file>
and i used this code to access the program
Code:
UPX
->start
("./Resources/upx.exe",
QStringList(QDir::toNativeSeparators(lineEdit
->text
())));
note that this code works fine when it is built shared.
it only does not work when it built static.
i mean by work that my program works but when i execute the last code it do nothing. it means the program doesn not see the console app.
i hope that is enough.
Re: problem with static building
First of all, you can't execute an executable which has been embedded as a resource. You would have to extract it first. Secondly, start("./Resources/upx.exe") does not even run it from resources but from a sub-directory called similarly.
Re: problem with static building
you are right.
i tried the shared version a way from the UPX.exe file and it did not work.
so how can i extracte it?
Re: problem with static building
Quote:
Originally Posted by
mismael85
so how can i extracte it?
I'd simply try with QFile::copy() from resources to disk. This way the OS has chances to actually execute it.
Re: problem with static building
i used this code
Code:
QFile::copy("./resources/upx.exe",
"c:\\")
but nothing copied in the c: directory.
Re: problem with static building
I thought it was "./Resources/upx.exe" not "./resources/upx.exe" and the second parameter takes the new name even if it remains the same, not just the target path.
Code:
if (QFile::copy(":/Resources/upx.exe",
"c:/upx.exe")) {
...
}
Re: problem with static building
and still "./resources/upx.exe" isn't a resource path...
Re: problem with static building
Quote:
Originally Posted by
ChristianEhrlicher
and still "./resources/upx.exe" isn't a resource path...
Oops, my bad. Thanks for pointing it out. ;)
Re: problem with static building
what is the difference between using
Code:
./Resources/upx.exe
and using
Code:
:/Resources/upx.exe
Re: problem with static building