Qt Compile For Mac
Qt is supported on a variety of 32-bit and 64-bit platforms, and can usually be built on each platform with GCC, a vendor-supplied compiler, or a third party compiler. In Qt Creator, a kit specifies the compiler and other necessary tools for building an application for and running it on a particular platform.
The Qt library allows you to make really cross-platform applications. Once written code can be compiled for many operating systems. But the problem is precisely in the word 'compile' because it means that it is necessary to reboot to the target system, have a customized development environment, installed and configured zoo of libraries. Cross compilation is a solution - a compilation that.
Qt Creator automatically detects the compilers that are registered by your system or by an installer and lists them in Tools > Options > Kits > Compilers:
- You need to supply an extra option to compile a QT binary./autogen.sh./configure -with-qt make -j8 Your binary will then be in /src/qt/ as expected. To turn it into an.app you'll need to read contrib/macdeploy/readme.md and then run make deploy to wrap it in.
- C Programming & Mac OS Projects for $30 - $250. Dear, I have a QT project who works fine on Windows and Linux. I have to port on Mac OS. You'll need Qt Mysql and FFmpeg and their dependencies, and where to place configuration files and translation.
You can add the following compilers to build applications by using other compilers or by using additional versions of the automatically detected compilers:
- GNU Compiler Collection (GCC) is a compiler for Linux and macOS.
- MinGW (Minimalist GNU for Windows) is a native software port of GCC and GNU Binutils for use in the development of native Microsoft Windows applications on Windows. MinGW is distributed together with Qt Creator and Qt installers for Windows.
- ICC (Intel C++ Compiler) is a group of C and C++ compilers. Only the GCC-compatible variant, available for Linux and macOS, is currently supported by Qt Creator.
- Clang is a C, C++, Objective C, and Objective C++ front-end for the LLVM compiler for Windows, Linux, and macOS.
- clang-cl is an alternative command-line interface to Clang that is compatible with the Visual C++ compiler,
cl.exe
. - Nim is the Nim Compiler for Windows, Linux, and macOS.
- QCC is the interface for compiling C++ applications for QNX.
In addition, the Qt Creator Bare Metal Device plugin provides support for the following compilers:
- IAREW is a group of C and C++ bare-metal compilers from the various IAR Embedded Workbench development environments.
Note: Currently supported architectures are
8051
,AVR
,ARM
,STM8
, andMSP430
. - KEIL is a group of C and C++ bare-metal compilers from the various KEIL development environments.
Note: Currently supported architectures are
8051
andARM
. - SDCC is a retargetable, optimizing C bare-metal compiler for various architectures.
Note: Currently supported architectures are
8051
andSTM8
.
Redetecting Compilers
When Qt Creator finds an x86_64 GCC compiler, it sets up an instance for the native x86_64 target. If you plan to create also 32-bit x86 binaries without using a dedicated cross-compiler, select Auto-detection Settings > Detect x86_64 GCC compilers as x86_64 and x86. Then select Re-detect to refresh the list of automatically detected compilers.
^. Software in Action. Retrieved 23 March 2012. Archived from on 29 February 2012.
To remove manually added compilers, select Remove or Remove All.
Specifying Compiler Settings
To build an application using GCC, MinGW, Clang, or QCC, specify the path to the directory where the compiler is located and select the application binary interface (ABI) version from the list of available versions. You can also create a custom ABI definition. For QCC, also specify the path to the QNX Software Development Platform (SDP).
To enable Microsoft Visual C++ Compilers (MSVC) and clang-cl to find system headers, libraries, and the linker, Qt Creator executes them inside a command prompt where the environment has been set up using vcvarsall.bat
. For these compilers, you also specify the path to the script that sets up the command prompt.
You specify the compiler to use for each kit in Tools > Options > Kits.
To add C or C++ compilers:
- Select Tools > Options > Kits > Compilers > Add, then select a compiler in the list, and then select C or C++ to add a C or C++ compiler.
To clone the selected compiler, select Clone.
- In the Name field, enter a name for the compiler to identify it in Qt Creator.
- In the Compiler path field, enter the path to the directory where the compiler is located.
- In the Platform codegen flags field, check the flags passed to the compiler that specify the architecture on the target platform.
- In the Platform linker flags field, check the flags passed to the linker that specify the architecture on the target platform. The linker flags are used only when building with Qbs.
The other settings to specify depend on the compiler.
- In the ABI field, provide an identification for the target architecture. This is used to warn about ABI mismatches within the kits.
Adding Nim Compilers
Qt Mac Address
To build an application using the Nim Compiler, select Tools > Options > Kits > Compilers > Add > Nim, and specify the path to the directory where the compiler is located.
Adding Custom Compilers
To add a compiler that is not listed above or a remote compiler, use the Custom option and specify the paths to the directories where the compiler and make tool are located and options for the compiler.
To add other compilers:
Exchange for mac. Outlook for Microsoft 365 for Mac Office for business Office 365 Small Business Outlook 2016 for Mac Office 2016 for Mac Outlook 2019 for MacThe following table provides information and tips for entering advanced Exchange settings.
- Select Tools > Options > Kits > Compilers > Add > Custom > C or C++.
- In the Name field, enter a name for the compiler.
- In the Compiler path field, enter the path to the directory where the compiler is located.
- In the Make path field, enter the path to the directory where the make tool is located.
- In the ABI field, specify the ABI version.
- In the Predefined macros field, specify the macros that the compiler enables by default. Specify each macro on a separate line, in the following format: MACRO[=value].
- In the Header paths field, specify the paths to directories that the compiler checks for headers. Specify each path on a separate line.
- In the C++11 flags field, specify the flags that turn on C++11 support in the compiler.
- In the Qt mkspecs field, specify the path to the directory where mkspecs are located. Usually, the path is specified relative to the Qt mkspecs directory.
- In the Error parser field, select the error parser to use. You can add custom output parsers to the list. For more information, see Using Custom Output Parsers.
Troubleshooting MinGW Compilation Errors
If error messages displayed in the Compile Output pane contain paths where slashes are missing (for example, C:QtSDK
), check your PATH variable. At the command line, enter the following commands:
If these commands show paths, they have been added to the global PATH variable during the installation of a tool chain based on Cygwin or MinGW, even though this is against Windows conventions.
To keep working with the third-party tool chain, create a new shell link that adds the required paths (as Visual Studio and Qt do). The shell link must point to cmd.exe, as illustrated by the following example:
C:WindowsSystem32cmd.exe /K C:path_tomyenv.bat
where the /K parameter carries out the command specified in the bat file.
Create the myenv.bat file at path_to, which should be in a convenient location. In the file, specify the paths to the tool chains. For example,
set PATH=C:path1;C:path2;%PATH%
where path1 and path2 are paths to the tool chains.
Finally, remove the paths from the global PATH, reboot the computer, and run the where
commands again to verify that the global PATH is now clean.
You can use the shell link to run the tools in the third-party tool chains.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
You have finally made the move to become a programmer. You’ve registered for a course, you have your texts and manuals, and you’ve fired up your trusty Mac. This is exciting! You think you are all set, and then it hits: they want you to have a compiler. What the heck is that? We’ll explain this and help you to get a C compiler for Mac up and running on your computer. If you are relatively new to the Mac, you can develop your skills with a course on getting started with a Mac.
The compiler is the last step in turning your code into a program that runs on your computer. You learn the C language to write source code. Source code cannot be understood and run by a computer in this state. It has to be converted to code that the computer can run. This is the job of the compiler. You feed your source code in to the compiler and it will either give you an executable program or a long list of error codes telling you why it couldn’t make the program. Source code can be written on any platform. It is meant for humans and is the same on any operating system. The compiler, on the other hand, has to be specific for the operating system where the program will run.
Compilers usually produce code that will run faster than the alternative, interpreters. The executable program can be distributed without the source code, which makes it harder for anyone to steal the programming ideas that went into the program. A disadvantage of compilers is that the compiling step adds time to the development process because the whole program must be compiled each time a change is made.
C Compiler for Mac using Xcode
The most recommended way to get a C compiler for your Mac is to use Xcode. This uses gcc, the popular open source C compiler. The details vary for each version of OS X. We’ll go through the recent versions here. You will have to register as an apple developer to get access to these tools. In order to do these installs, you will be using Terminal to work at the command line. Get a solid foundation on the Mac command line with this course.
For all of the versions of OS X, you will be downloading Xcode. Xcode is an Integrated Development Environment, or IDE. An IDE allows you to write, compile, and debug a program from one central interface. Xcode can act as an IDE for C programming. All of the install methods involve first getting Xcode, then making the gcc compiler available outside of Xcode, and then installing a newer version of gcc.
For OS X 10.6 Snow Leopard, download Xcode 3 from the Apple Developer Site. This will give you a working version of gcc, but it is an older version. If you want or need a more up to date version, that is available at High Performance Computing for Mac OS X. You can install this after installing Xcode. The files must be unzipped and installed at the command line. After that, you will need to update your Shell resource file so that the newer versions are used. Details can be found at Installing the GNU compilers on Mac OS X.
For OS X 10.7 Lion, you must get Xcode 4 from the Mac App Store. It is free, but you need to supply credit card information in order to have an App Store account. For Xcode 4.2, what you download from the App Store is an installer, which you then run. For Xcode 4.3, it is installed automatically, but it does not have gcc in the correct location. To finish the job, start Xcode and go to Preferences, Downloads, Components. Click on the Install button that is next to Command Line Tools. This gives you older versions of gcc. For the newest versions, you can use High Performance Computing for Mac OS X, as described for OS X 10.6. The process is similar and details can also be found at Installing the GNU compilers on Mac OS X.
OS X 10.8 will be very similar to 10.7. Install Xcode, then install the command line tools from the preferences. You can then get the newer versions of gcc as described for version 10.7.
OS X 10.9 Mavericks will use Xcode 5 and a revised process. Xcode 5 does not have the option to install the command line version of gcc. Instead, ensure that Xcode 5 has all available updates installed by checking from within the program. Then go to the Apple Developer Site and find the latest version of Command Line Tools (OS X Mavericks) for Xcode. It is a standard installer package. Finally, you can update the version of gcc in a manner similar to the other versions of OS X.
Other C compilers for Mac
Apple has extended the gcc compiler with a version called llvm. It incorporates more modern functioning and has a different licensing model needed by Apple for its proprietary software. Clang is an IDE for this compiler. It is designed to give more user-friendly error messages. Clang will give you the latest tools used by Apple for development. The downside is that there is no installer. It has to be built from source code, which means that you will need gcc already. Details are given at the llvm site.
Qt For Mac Download
Another option is given by Eclipse. Eclipse is a popular IDE for Java. The CDT plugin for Eclipse gives it the ability to compile C programs and become an IDE for C. Details can be found at the CDT page of the Eclipse site.
Now that you have a C compiler for your Mac, you can try a tutorial to write a simple program. Then get a solid start in C programming with this course for beginners. If you already know one language, extend your skills with a course for intermediate coders.