How can I add frameworks in Xcode 4? - qt

I am building my Qt project in Xcode 4.2, using an external build system project (building with 'make'). I have the build system ready and I can build applications, but I can't import Qt code from the code editor. So how do I link against the QtGui.framework and the QtCore.framework in Xcode 4.2 using 'External build system' project settings?

Read the documentation on qmake.
From the pro file you can create a xcode project.
Developers on Mac OS X can take advantage of qmake's support for Xcode project files, as described in Qt is Mac OS X Native, by running qmake to generate an Xcode project from an existing qmake project files. For example:
qmake -spec macx-xcode project.pro
Spend some time in understanding qmake, it will help you a lot.

Related

How to use Visual studio code with Qt/Qmake? (macOS)

How to use Qt with Visual Studio Code? I have Qt 5.15.1 installed which builds my code for macOS, Android and iOS.
Is it possible to have Visual Studio Code build my Qt application for macOS, Android and iOS like QtCreator does?
Environment:
My developer environment is macOS Catalina.
If you're using cmake, which you should, then all you need to do is configure your cmake project to point to your Qt folder, which basically means setting the project's Qt5_dir env variable to point to your Qt installation.
Here's what you need to do to get Visual Studio Code to work with Qt using Microsoft's CMake Tools extension:
Verify that you really have Qt installed,
Install Microsoft's CMake Tools extension,
Open CMake Tools extension's "Edit CMake Cache (UI)"
click on "CMake extension" on vscode's activity bar to open "CMake: project outline",
click on the "View and more actions" button (i.e., elipsis on upper right corner of the project outline.
Edit CMake's cache to point Qt5_dir to ${QTINSTALLDIR}/5.15.1/gcc_64/lib/cmake/Qt5
Rebuild project.
You can achieve the same goal by using cmake-gui to configure your cmake project.
If instead you really want to stick with qmake then it's enough to setup a build task that runs qmake.

Qt Static Linking not working without msvcrt.dll

Hello my problem is how to build qt application without need a msvcrt.dll
and builded a exe need msvcrt.dll how to fix? im trying build with /MT commandline argument but not working ineed make a full Standalone Qt application.
Thank you
The solution is to use ./configure -static -static-runtime for MSVC when building Qt. It will link the windows runtime libraries statically.
-static-runtime .... Statically link the C/C++ runtime library.
or you use MingW as your compiler. MingW will not have the typical windows runtime dependencies. There may be dependencies, but they are already available on every Windows system.
As far as I know -static-runtime is available somewhere from Qt 5.x

Qt Creator - setting up a kit with a cross-compiler

I'm attempting to use Qt creator to cross-compile a project, but have an issue matching the Qt version and my specified compiler toolchain.
I have created a Kit setting up a Device, selecting my toolchain as the compiler (GCC ARM Linux in this case), but I only have a locally installed system Qt (5.0.2 on Mint x86).
Qt Creator understandably tells me the compiler cannot produce code for the Qt version; all the guides I have found suggest using a Qt compiled for the target platform. This doesn't make sense though - it attempts to run qmake compiled for a different architecture and fails
How do I install or configure/compile a Qt version to work with the cross compiler? Maybe I can modify my existing one to understand this setup?
Thanks
This makes absolutely sense. The advice to use a Qt, which is compiled for your target platform is correct. But this does not mean that you use a Qt that was compiled natively on that target platform. You need to use a Qt, which was compiled with a special cross compiler on your host platform for your target platform. This way qmake and other build tools remain executable on your host, but create configurations for your target.
So, if you have a compiler, which can create ARM code, use it to build your Qt. Then you can create a kit in QtCreator out of this compiler/Qt pair.
Greenflow is right. I would like to add some information. I have cross compiled Qt 5.4.1 on Windows having an ARM Linux as target platform. You just need to configure the build properly. Here's what I did:
./configure -platform win32-g++ -xplatform linux-arm-gnueabihf-g++ .....
So Qt tools (qmake,moc,etc...) were built as Windows binaries and all the libraries were built as Linux binaries. Check for the available platforms in qtbase/mkspecs.

QT building project -- static build

I am new to QT. I have just installed Qt 4.7.4 (32 bit) which uses mingw compiler. I have few questions.
Please try to answer these :--
I have created a gui application in QT creator. With build configuration For each QT version one debug & one release now it created a build folder geny-build-desktop-Qt_4_8_1_for_Desktop_-MinGW_Qt_SDK__Debug
Inside this folder three makefiles are there :---
Makefile
Makefile.Debug
Makefile.Release
Inside this folder two folder are there :---
debug ---> contains compiled .exe file
release ---> empty
Q-1> How can I change settings in QT creator to compile my project for the release build ?
On the left toolbar of Qt Creator you will find the button to set the build for your project, set it to release.
With your settings a folder named geny-build-desktop-Qt_4_8_1_for_Desktop_-MinGW_Qt_SDK__Release will be created with a release subfolder in it, containing your compiled binary.
Anyway, it doesn't have to do with static build, it is simply a release build of your binary, still depending on Qt dynamic libraries. The difference is that the debug build is linked to the debug libraries (for example: Qt5Cored.dll), while the release build is linked to the release libraries (for example: Qt5Core.dll).
Release builds are usually optimized and don't include debug symbols, so they are also smaller.
If you think about static linking Qt to your program (i.e. getting a binary which not depends on Qt dynamic libraries) you should be aware that you should get a commercial license.
Try using the CTRL + T combination.

Importing a CMake project in QtCreator

I'm trying to import my Cmake project in QtCreator, which I'd want to use as code editor, but with completition for Qt classes an the possibility to do the build via Ctrl+R
When importing the Cmake project, the QtCreator ide hangs when running CMakeWizard when I try to select RunCmake. If I cancel an empty windows pops up and the project is not generated.
Is it possible to import an existing cmake project in QtCreator?
Ubuntu 10.10 x86_64, QtCreator 2.6
Normally you just do "Open Project" and then select the CMakeLists.txt as the project file. QtCreator will then ask you to run CMake once (to generate a CodeBlocks build file, which is then interpreted by QtCreator). After that you have native support for your CMake project.
It even works with rather complicated CMake scripts.
If you observe hangs etc., you should probably file a bug report with the QtCreator project.
I had a similar issue when qtcreator crashed when opening cmake projects created in older versions of qtcreator. Removing CMakeLists.txt.user and running qt from terminal resolved issue for me.
cd /path/to/project/
qtcreator .

Resources