How To Run A C Or C++ Program On iOS
A fast and reliable C and C++ Compiler and IDE for app development software for iOS is very important for beginners and professionals alike, whether they are developing C++ for iOS or for any of the other operating systems and targets. The C and C++ programming languages are subjectively the World’s most powerful programming languages and consistently appear in the World’s top three most popular programming languages. Thanks to its huge range of ready-made variables, functions, methods, namespaces and libraries it’s the do-everything toolkit which can be used for everything from regular simple apps to low-level operating system drivers, IoT hardware control and everything in between. When a user wants to develop modern C++ applications, she or he will benefit from investing a very small amount of time in becoming familiar with the functions, features and shortcuts of a professional IDE. A small effort in that area pays dividends in productivity. In this post we explain basic of using C++ Builder to create an iOS app as a guide for beginners.
What is a good IDE for creating a C++ program for iOS?
Do you know that you can develop C/C++ iOS Apps on Windows 11 with the latest RAD Studio / C++ Builder? C++ Builder supports all C commands and CLANG LLVM, C++ 17 standards. RAD Studio with C++ Builder and Delphi is a great IDE and compiler running on Windows that supports multi-device applications for different platforms including iOS and you can develop native ARM applications for M1 Silicon CPUs used in the latest Apple hardware too. So, your application’s program code can be recompiled so that it runs on everything from the latest Windows 11 version as well as on Apple ‘desktop’ devices such as the MacBook laptops, Mac Minis and iMacs using either Intel processors or the new M1 ‘Silicon’ CPUs. Yet that same program code can almost entirely be reused with little or no changes so it may be compiled for iOS where your apps can run on the very latest iPhone devices. Everywhere your users are, your C++ and Delphi apps can be.
In my opinion, because of its multi-device application and great tools of IDE, C++ Builder is the best C++ IDE Software and the best CLANG-based compiler that supports multi-device applications for all your needs including professional iOS application.
How to create and run a C++ Program for iOS with the RAD Studio IDE and C++ Builder?
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, macOS, and iOS operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs. There is a free C++ Builder Community Edition for students, beginners, and startups.
More details about C++ Builder & RAD Studio for the beginners can be found in Official Wiki of Rad Studio.
You can download the free C++ Builder Community Edition here: https://d-data.ro/product/c-builder-in-romania//starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://d-data.ro/product/c-builder-in-romania/.
See What’s New in RAD Studio 11
Download RAD Studio 11 Now
Here are the features of the C++ Builder CE version.
- Build Windows and iOS C++ Applications 10x Faster with Less Code.
- C++Builder Community Edition provides you with an integrated toolchain and professional-level developer tools from Day 1
- Featuring Clang-enhanced compiler, Dinkumware standard library, MSBuild/CMake/Ninja support, and popular libraries like Boost and Eigen.
- Develop Windows and iOS applications with a single codebase and responsive UI
- Enjoy the award-winning Visual Designer using the C++Builder VCL and FireMonkey frameworks for maximum productivity
- Built-in Debugging Tools that allow you to debug on any device
- Build database apps with local/embedded capabilities
- Hundreds of included components to enhance your app and reduce development cycles
- Direct access to InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, DB2, SQL Anywhere, Advantage DB, Firebird, Access, Informix, MongoDB, and more.
- Licensed for use until your individual revenue from C++Builder applications or company revenue reaches $5,000 US or your development team expands to more than 5 developers
How to run a C++ program in an IDE?
C++ Builder IDE has mainly 5 Parts, the Code Editor Window and Form Designer, Projects Window, Palette Window, Structure Window, Object Inspector Window. You can find more , less commonly used windows from the main IDE menu as well as the right-click context menus. All the basic sections can be summarized in this IDE picture;
Now let’s explain each of these areas shown above.
1.The Code Editor and Form Designer: The Code Editor and the Form Designer occupy the center pane of the IDE window. The Code Editor is a full-featured, customizable UTF8 editor that provides syntax highlighting, multiple undo capability and context-sensitive help for language elements. You can switch between them by using F12 or from lower tabs in IDE. As you design the user interface for your application, RAD Studio generates the underlying code. When you modify object properties, your changes are automatically reflected in the source files.
2. The Project Window : The Project Window displays and organizes the contents of your current project group and any project it contains. You can perform many important project management tasks, such as adding, removing, and compiling files. The default location of the Projects window is the upper right corner of the IDE, but the window is dockable, as are many windows in the IDE
3. The Tool Palette Window: The Tools Palette Window has UI elements, components that can be used in application UI design, it assists with a new project, adds components to a form, or adds code snippets to the Code Editor.
4. The Structure Window: The Structure View Window displays a tree diagram that shows the hierarchy of elements in the active window (that is, the Code Editor or the Form Designer)
5. The Object Inspector Window: The Object Inspector is used to examine and edit the properties and events for the currently selected object or objects. Every design object (Components, UI Elements) can be edited by clicking on it then setting its properties and events in the Object Inspector Window.
Running C++ Code: You can Run your code by pressing F9 or Run button on the top bar. You can use other Run Without Debugging. There is a Stop and Pause button if your code is in loop. On the run time you can use debug, break points, watch variables and many other runtime features.
Switching between the Design and Code View: You can press F12 to switch between the Code Editor and Form Designer. The latest C++ Builder also allows you to use both of them together in the same screen. You can switch code, header and design view from the bottom top bars.
Switching Between the Code Files: You can use tabs on the top to switch between .c or .cpp files and .h headers.
How to run a C++ program project for iOS?
C++ Builder greets you with a Welcome Screen. You can create a new project by using File->New menu on the top. By using this menu. You can create a new MultiDevice Application in C++ Builder with FireMonkey framework or a new Windows VCL Application in C++ Builder with VCL framework or you can create a Console Application in C++. There are more options to develop more professional static, dynamic libraries.
When you create a project this will create a Project source code file and a Unit which has a visual window. Your project will have .bpr, .cpp, PCH.h files, this project also includes two more .cpp and .h units. You can start designing your app with this ready-made unit as launching point, adding your own code by modifying these Unit files and its .h header. You can add more Units with new .cpp and .h files in your project..
What are the full steps to run a C++ program for iOS?
Here are the full steps to develop iOS apps using Windows.
Step 1. Download the free C++ Builder / C++ Builder Community Edition to Develop iOS Apps on Windows
C++ Builder CE is the easiest and fastest Windows development C & C++ IDE tool to develop simple or professional applications on iOS. It is also easy for beginners to learn with its wide range of samples, tutorials, help files and LSP support. C++ Builder comes with Rapid Application Development Studio, also knowns as RAD Studio, and C++ Builder is one of the most professional IDEs that work under RAD Studio.
You can download the free C++ Builder Community Edition here: https://d-data.ro/product/c-builder-in-romania//starter.Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://d-data.ro/product/c-builder-in-romania/.
Step 2. Install RAD Studio / C++ Builder with iOS platform support
Run RAD Studio Installer and during installation be sure that C++ Builder iOS Enterprise is checked as shown below. See Additional Options tab, select Samples and Help or any other options needed, then press Apply.
If you forget to install iOS support don’t worry, RAD Studio / C++ Builder allows you to install these packages from the IDE. Just run RAD Studio / C++ Builder go to Tools -> Manage Platforms … then check C++ Builder iOS Enterprise option. See Additional Options tab, select Samples and Help or any other options needed, then press Apply. This will Install the latest iOS development packages for the C++ Builder.
Step 3. Create a new C++ project to develop iOS apps on Windows
If you download C++ Builder Community Edition (or RAD Studio CE version) or any Professional, Architect, Enterprise versions of C++ Builder. Install it on your Windows computer and run RAD Studio or C++ Builder.
1. Choose File->New-> “Multi Device Application- C++ Builder” menu
2. Select Blank Application to develop application with a blank form UI. You can add many UI components on it later.
3. Save all Unit File and Project file to a folder by using File -> Save Project As .. menu. For example: Folder name can be MyIOSApp and Unit file name MyIOSApp_Unit1.cpp and the project name MyIOSProject_Project1
Step 4. Change your platform to iOS
On the right side there is Project window which lists platforms for this project. Multi-Device projects can be compiled for Windows, iOS or Android, the default is Windows 32-bit. To see these OS platforms, click the > icon on the left of Target Platforms section. This will show platforms, then double click to activate iOS Device 64-bit. After this all compilations will be done for the iOS platform. Anytime, you can back to Windows or Android and you can compile your project for that platform too.
Step 5. Add your UI items to your form design
In C++ Builder, you can add your UI elements (also called as components) by dragging them from your Palette Window. There are many visual and non visual components for the C++ Builder. For example, you can drag a Memo (TMemo) component to see outputs visually and a Button (TButton) to receive click, given as below,
Step 6. Add your C or C++ code to develop iOS apps on Windows
Note that you can easily switch between UI Form Design and Code Area by using use F12 key. Or you can also use tabs below the IDE. You can easily switch between .cpp, or .h header codes and Design.
If you did 3rd part of Step 4, now, you can modify inside of Button1Click() as given example below,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include #pragma hdrstop
#include “Unit1.h” //————————————————————————— #pragma package(smart_init) #pragma resource “*.fmx” TForm1 *Form1; //————————————————————————— __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //————————————————————————— void __fastcall TForm1::Button1Click(TObject *Sender) { UnicodeString ustr; ustr.printf(L“Hello, Pi is %8.3f”,M_PI); Memo1->Lines->Add(ustr); }
|
This example above is a modern “Hello World” example for iOS which runs with C++ Builder. Modern applications have a GUI. Note that VCL projects are Windows only. FireMonkey projects are Multi Device (multi-platform) applications that you can compile and run on Windows, MacOS, iOS and Android.
Step 7. Install PA Server to develop iOS apps on Windows
The Platform Assistant server (named paserver) is a command-line application that can be installed on Windows, macOS, and Linux. You install the Platform Assistant on a remote system, in the same network as your development system, to let RAD Studio interact with that remote system, so that you can develop cross-platform (multi-device) applications for macOS, iOS, Linux, or Win64 (this last from a Win32 development system). The Platform Assistant allows you to develop multi-device applications and to debug applications remotely.
The Platform Assistant needs to be running and connected to the IDE in order for you to do the following:
Installing PA Server on Mac:
Here is the latest official link that explains how to install PA Server on a Mac device,
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Installing_the_Platform_Assistant_on_a_Mac
Running PA Server on Mac:
Here is the latest official link that explains how to run PA Server on Mac device,
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Running_the_Platform_Assistant_on_a_Mac
Installing the PAServer Manager on a Mac:
Here is the latest official link that explains how to install PA Server Manager on Mac device,
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Installing_the_PAServer_Manager_on_a_Mac
Acquiring Permission to Support Debugging on a Mac:
Here is the latest official link that explains how to acquire permissions to support debugging on a Mac device,
More about PA Server:
If you need to know more about PA Server for different Operating Systems please check this official page
Step 8. Create a connection profile and compile your C++ project for iOS
If you installed PA Server successfully press F9 to run click Run with Debugging.
In the first time, it will as for the Connection Profile name for the PA Server. Give a name and then Enter your remote machine IP and passwords as below,
For the general usage in C++ Builder;
1. Run project by hitting F9 or click Run with Debugging
2. If there is error, please check your lines
3. If all is fine then save all project
If you are a beginner “Hello World” examples are good to understand features of that programming language. If you still have problem during these steps or you want to learn more about iOS development, follow this link.
You can download the free C++ Builder Community Edition here: https://d-data.ro/product/c-builder-in-romania//starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/pr