Cross-platform C SDK logo

Cross-platform C SDK

Quick start

Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

"...the number of UNIX installations has grown to 10, with more expected..." Dennis Ritchie and Ken Thompson - June 1972

NAppGUI is an SDK to develop software projects, that work on any desktop platform (Windows, macOS or Linux), using the C programming language (Figure 1). C++ is allowed, but not indispensable. We can write a complete program using only ANSI-C.

Capture an application on Windows, macOS and Linux written in C with NAppGUI.
Figure 1: NAppGUI allows the easy port of applications written in ANSI C.

1. Quick start in Windows

Before starting you need to have these tools installed (Figure 2):

  • Visual Studio to compile under Windows. Microsoft offers the free Community version.
  • CMake. Cross-platform tool to create compilation projects automatically, from source code. Be careful to select Add CMake to the system PATH for all users during installation (Figure 3).
  • Git. For download the project from GitHub.
  • Visual Studio, CMake, and Git icons.
    Figure 2: Basic tools in Windows.
    The CMake installer showing the PATH selection in Windows.
    Figure 3: Access to CMake from the command line.

From a console on Windows:

git clone --depth 1
cd nappgui_src
cmake -S ./src -B ./build
cmake --build ./build --config Debug

Once compiled, you will be able to run the existing example applications in the demo and howto directories (Figure 4).

Running a sample application on Windows.
Figure 4: Running the Products sample program after compilation.

2. Quick start on macOS

Before starting, make sure you have installed and configured Xcode, an essential environment for development under macOS. You will also need to download and install CMake from (Figure 5).

The CMake bundle about to be installed on macOS.
Figure 5: Xcode and CMake on macOS.
By default, CMake does not configure command line access on macOS. You can create symbolic links with sudo "/Applications/" --install.

Open a terminal in macOS:

git clone --depth 1
cd nappgui_src
cmake -G Xcode -S ./src -B ./build
cmake --build ./build --config Debug

Once compiled, you can run the existing sample applications in the directories demo and howto (Figure 6).

Running a sample application on macOS.
Figure 6: Running the Bricks sample program after compilation.

3. Quick start on Linux

Before starting, make sure you have the necessary compilers, tools and libraries installed:

// Development tools
sudo apt-get install build-essential
sudo apt-get install git
sudo apt-get install cmake

// Development libraries
sudo apt-get install libgtk-3-dev
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
sudo apt-get install libcurl4-openssl-dev
NAppGUI requires at least gcc 4.6, gtk3 (for desktop applications), OpenGL (if your application uses 3D graphics) and Curl (for Web protocols). All this is included as of Ubuntu 12.04 LTS or similar distributions.

Open a terminal:

git clone --depth 1
cd nappgui_src
cmake -S ./src -B ./build -DCMAKE_BUILD_CONFIG=Debug
cmake --build ./build -j 4

Once compiled, you will be able to launch the existing example applications in the demo and howto directories (Figure 7).

Running a sample application on Linux.
Figure 7: Running the Col2dHello sample program after compilation.

4. MIT License

NAppGUI is distributed under the MIT license, which essentially means that you have complete freedom to use this software freely and for free, both in commercial and free projects. The only restriction is that you must include a copy of this License in every substantial part of the software you distribute.

5. Previous knowledge

This book is not intended for beginners. Although the NAppGUI project is aimed at simplifying the construction of cross-platform applications, it requires certain prior knowledge on the part of the user. You will need, at least, to be fluent in C or C++ since at no time we will stop to explain basic programming concepts. If you come from Java or C#, you should review pointers. You will also need some skill with Visual Studio and Xcode development environments, and Unix tools such as gcc, make or the command interpreter.

On the other hand, if you are an advanced user, you will find a simple system to create very fast and small C applications that will compile without changes in all desktop environments. You will also have at your disposal a set of precompiled C libraries to create user interfaces or command line applications, without the need to mess up your projects with the cumbersome class templates that stl or boost provide.

6. And now what?

Next ❯