I'm trying to build a Qt project which runs fine on windows on OS X 10.6. However, my application cannot access the resources in my qrc file anymore. Are all files in the qrc packed in that application bundle (xyz.app) by default? When I open the generated bundle, there's nothing in the Resources folder except the desktop.rc file. Am I missing something?
Qt translates/converts qrc files into cpp files then compiles and links them into the application binaries. There's no resource file in OS X sense.
The only separate resource file Qt can handle is the application icon. Add this line to pro file:
ICON = MyAppIcon.icns
And it will be copied to the Resources folder and info.plst will be updated to use it.
File names in Windows are not case sensitive, but in OS X they are. Could it be that the file names (or directory names) in your code differ in case from the file names in the resources? If they are, they would still work in Windows but not in OS X.
Well, actually we I switched from a german windows to a us version of osx. All our resources had "de" in their language field, so my us osx couldn't find any resource at all.
Related
So I have Visual Studio 2013 (community edition) with Qt addin installed, Qt5 libraries (32bit), and I'm trying to create an executable that is independent of all development configurations (it may use static or shared libs, I don't really care at this point).
OS: Windows 7, x64.
For doing this I changed the Solution Confguration visual studio option from Debug to Release, and add all the necessary libs in Configuration Properties -> Linker -> Input -> Additional Dependencies. The application now starts only if I run it from visual IDE, If I try to start it from the generated .exe I got The application was unable to start correctly (0xc000007b) error.
I have searched and found that this error code indicates one of the following problems:
32-bit app tries to load a 64-bit DLL (not my case I think, Qt DLLs are 32bit (I have installed using this .exe: qt-opensource-windows-x86-msvc2013-5.5.0.), and I use some other .DLLs which are also 32bit).
There are some missing DLLs. (I did copy all the necessary Qt DLLs in the same folder with the final executable).
For checking what dependencies my app requires, I opened the .exe file with Dependency Walker application, this is what it shows me:
in this list were also Qt5Multimedia.dll and Qt5SerialPort.dll, I get rid of the errors by copying the .DLLs in the same folder with the .exe.
Any ideas how to solve this?
You should never do that operation manually unless the standard procedure completely fails. There is already standard tool for Qt Windows deploymend windeployqt.
It takes care about Qt DLL dependencies, makes a copy of platforms\qwindows.dll and also it makes a copy of libraries that you cannot detect with the Dependency Walker, since image plugins and some other are loaded at runtime.
You do not even need to have your Qt bin folder in your environment PATH. The simplest deployment:
copy built exe binary to a new folder
open cmd console in that folder
call windeployqt using its full path (if it is not in the system PATH) and provide your executable, for example:
c:\Qt\Qt5.5.1-vs2013-x64\5.5\msvc2013_64\bin\windeployqt.exe application.exe
As a result you have in that folder all needed Qt DLLs. Of course you can have also issues with MSVC redistributables, but those should be deployed separately and installed once per system.
The tool windeployqt has various options. It can also take care about deployment of qml related files.
Only some 3rd party libraries should be copied manually if they are used, for example OpenSSL.
Solution:
As I got deeper, I have found this answer, after doing what that answer indicates (I actually copied all the .DLLs located in \Qt5.5.0\5.5\msvc2013\bin to the folder where my .exe is located), the error message changed from The application was unable to start correctly (0xc000007b) to Application failed to start because it could not find or load the QT platform plugin “windows”.
Searching on web for more about this error, I have found from this answer that you also need the platforms folder in the same location with the .exe (which was located in Qt5.5.0\5.5\msvc2013\plugins path). After copying that folder, the application started without any problems!!!
Now I just need to delete all unnecessary .DLLs from my application folder (Dependency Walker does not offer very useful information about this), and all the deployment is done.
I have solved the problem in the same time as describing it, so I guess I will just leave this here, may help others that have the same problem.
I have deployed a QML application (static build on windows, following this how-to: http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW). However, the qml_import_trace (screenshot below) reveals that LocalStorage is loaded from the Qt/Static folder on the development computer, not from the release folder. Hence, when launched at another computer, the LocalStorage module is not found. How may the LocalStorage plugin/module be shipped with the application?
Including the following lines in the .pro files will give svg support. Am I only missing a qtplugin for sql/localstorage? In that case, what is the proper plugin name? Also, where can I find valid inputs for QTPLUGIN+= and QT+= ?
QTPLUGIN += qsvg
QT += svg sql
If I understand you correctly you want to copy the needed files to the release folder automatically.
Use the windeployqt.exe (in qt/bin folder) with --qmldir option. It will scan the given path for QML files and collect the QML components imported in those files.
A solution, although not optimal, was to manually copy the QtQuick/LocalStorage folder from the static folder into the release folder
How can I send my java application to a friend without having to send the entire project and being dependent on him having JDK? I'm aware of the .jar-file's existence, but I don't know how to proceed. I would like to be able to just send him the .jar-file or an executable file.
Any ideas?
Compile it to native code using a compiler such as http://en.wikipedia.org/wiki/GNU_Compiler_for_Java
Also, he doesn't need the JDK, just the JRE.
Did what #Barranka said regarding the dist folder, didn't know that worked until I read the readme file as #Barranka suggested.
So to quote what #Barranka said:
If you work with NetBeans, when you "build" your project, a dist
folder is generated, and your "packed" app is stored there. You can
send the contents of this folder. Read the "readme" file in that
folder. – Barranka
You can send the JAR file alone provided your program does not depend on other libraries. Assuming that there is a main() method and Main Class is configured in the JAR's manifest, the person can run it by Double Clicking (on windows) or use the command line
java -jar <jar_file_name>.jar
You cannot execute a Java application without a Java Virtual Machine, so you need one.
Your friend has to download a JRE/JDK, or you can provide it with your application directly as it (the JRE and your project in an archive) or provide it as a native compile code using GCJ or Excelsior Jet which will compile your application and a JRE.
As you can see the is no solution for your question, but there is one for your problem : ask your friend to download a JRE.
So, I made a Qt application on Qt Creator that displays jpg files and mp3 files(using phonon).
On deploying the application with dynamic linked libraries I had to copy to the same folder QtCore4.dll, QtGui4.dll, phonon4.dll, mingwm10.dll and libgcc_s_dw2-1.dll as required by Windows.
The problem is that the jpg files and mp3 files are only shown on pcs with the QtSDK installed. In other pcs the exe file runs, opens the user interface and does everything right except showing jpg and mp3 files. The directory path is not the problem because it opens a pdfviewer that I put in the same folder. Do I need to provide other files?
Qt relies on plugins for most of the file formats. For Jpeg you will need to include the qjpeg4.dll found in the plugins/imageformats directory. For Phonon, you will also need to include the appropriate backend DLL found in the plugins/phonon_backend directory.
All the information you need is contained within the Qt documentation on Deploying an Application on Windows and especially the section on Qt Plugins.
Basically, Qt provide the cross-plateform.
I have made a application which is used Qt creator on Linux.
But, I can't be running that on Windows because it can't find .dll files such as mingw10.dll and qtcore4.dll, etc.
So, I have copied the .dll files which can be found in qt/bin directory.
And, I create a directory in order to save that like /lib becuase of distribution of application.
But, I can't set up path in .pro file.
How to set up the path for .dll?
Thank you.
You can too compile QT statically in order to not have to link dlls to your exe.
You say you've successfully compiled the app, so the only problem is that it can't find the DLLs.
There are a few solutions, and they have nothing to do with the .pro file. Your two best bets are:
Make sure the DLLs are in the same directory as the .exe file
Make sure the DLLs are in a directory contained in the PATH environment variable