Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / IoT / Raspberry-Pi

Getting Started with U++ 2022.2

5.00/5 (37 votes)
26 May 2022CPOL8 min read 86.5K  
Installation and the first look at U++ platform
This article provides basic information about U++ environment and the steps needed to install it on your computer.

Table of Contents

Why Should I Care?

U++ is an open source C++ framework/development environment which is at the moment best suited for small teams with ambitious projects that do the "real stuff", like engineering application to design buildings, wind farm simulation, point of sales terminals, SQL client-server office agenda, business sales or complex website backends (yes, I am listing real world examples here). It however also scales well from smallest utilities, as can be seen here.

It is designed around some rather extreme principles to maximise both developer productivity and performance.

While the complexity of C++ language cannot be abstracted out (but is definitely required to achieve both productivity AND performance goals), experienced U++ programmers might find themselves more productive doing tasks in U++ rather than using "easy to use" scripting languages like Python, which is our ultimate goal.

At the same time, U++ Core libraries provide about 3 times better performance than standard C++ library in areas like string operations and mapping, which consist of a bulk of load in many scenarios (think e.g. about processing JSON or parsing files).

On top of that is the modular system of sources and corresponding build system which make management of large projects much simpler.

One fact to summarize it all: It takes just 45 seconds to completely rebuild the U++ development environment (TheIDE) AND all the framework libraries in debug mode. (You can actually try that right after installation as TheIDE sources are part of the release).

And it has a nice cat picture in one of demonstration examples too!

U++ currently exists for Windows, X11 and MacOS platforms.

Where to Download

Stable releases can be found at https://sourceforge.net/projects/upp/.

U++ is currently released as LZMA compressed archive (.7z for Windows, .xz for POSIX / MacOS).

Linux, FreeBSD and OpenSolaris Installation

In Linux, U++ has to be compiled for the target distro while satisfying dependencies. However, the process is quick and mostly automated for majority of popular Linux flavors. After unpacking the archive, cd to the upp folder and run the ./install script:

Image 1

The script should be able to detect your Linux distribution and suggest the command to install required dependencies. It can even install these if you do not mind sharing your sudo password, or you can just copy the command to separate terminal and run it yourself. The same ./install process should also work fine for FreeBSD and OpenSolaris derived systems.

After that, the development environment will get compiled from the source code, which should take a couple of minutes on modern x86 CPUs (and about 15 minutes on Raspberry PI 4):

Image 2

After that, ./theide binary is produced, which could be started immediately with the script and you should see something like this:

Image 3

Note: Unless you move theide binary somewhere else, it will not write anything outside upp directory. Once you get bored with U++, just delete upp.

After this point, working with TheIDE is essentially the same on all platforms.

OpenBSD Specific Notes

In OpenBSD, you need to resolve dependencies manually before running the ./install script by running:

pkg_add bash pkgconfig

(This should work as long as you have installed desktop environment before installing U++.)

It is also necessary to increase the allowed memory sizes in /etc/login.conf to:

default:\
    :datasize-max=4096M:\
    :datasize-cur=4096M:\
    :stacksize-cur=512M:\

otherwise compiler will run out of memory. After that, follow instructions for Linux.

Windows

In Windows, TheIDE is precompiled and U++ comes with all dependencies needed, including clang compiler. Simply unpack the archive and start theide.exe.

Image 4

Once again, U++ is self contained and nothing will be written outside the upp directory. After starting theide.exe, you should see essentially the same dialog as with Linux:

Image 5

MacOS

In MacOS, TheIDE is precompiled in the archive, however U++ requires C++ toolchain to build applications. You can find a description of how to install the toolchain, e.g., here.

Some other tools and libraries can be installed with homebrew. The following packages are recommended (as in they might be required in certain contexts): openssl, libssh2.

To start TheIDE, you simply launch theide.app from the unpacked archive:

Image 6

You should now see essentially the same dialog as on other platforms:

Image 7

Select Main Package Dialog

Without going into much details, we shall now describe what you see in the dialog.

Assembly is basically a list of directories to look for source code modules. The term for such modules is package. Package is basically a directory with C++ source files and some meta information that describes how to compile the package and dependencies on other packages.

The Assembly list you see in the dialog is editable, but after you start TheIDE for the first time, it creates a predefined set of assemblies based on sources that come with the release. Here, examples contain mostly more complex demonstration examples to "show the power of U++" (and some cat pictures), while reference contains nearly 200 examples demonstrating various aspects of U++ framework. tutorial are examples that accompany several multi-step tutorials on U++ website. uppsrc is assembly that contains basic U++ libraries and utilities and source code of TheIDE itself. MyApps is assembly that is prepared for your initial experiments with U++.

Besides "canonical" modules, U++ releases also come with huge community contributed content called bazaar. At the moment, quality and usefulness of bazaar code widely varies, so use with caution. examples-bazaar are demonstration examples of these packages, while MyApps-bazaar is assembly ready for your projects that also contains bazaar packages.

Trying the First Example

Let us now load, compile and run one of the examples. Select examples and in the list of packages, choose Days (of course, you can choose any other example, but Days is what the following screenshots show). TheIDE will load the project and you should see this:

Image 8

In the left top corner, there is a list of packages. Days is the package that you have selected (it is the main package), other packages listed are its direct or indirect dependencies. Under that list area is a list of files of currently selected package. Note that this means that all source files of U++ project, including all source files of U++ framework, are usually 2 mouse clicks away (you actually have to be somewhat careful not to damage framework files by editing them).

The center of window obviously contains the source code of current file. On the right is something called "navigator" - this is a search tool based on C++ source code analysis of the whole project.

To compile and run the project, press Ctrl+F5 or choose "Execute" in Debug menu.

Image 9

The whole project will now compile and the application will be launched.

Image 10

Note: The first time you do that, for a given configuration, U++ will need to compile the whole framework, so expect anywhere up to one minute to finish. Next compilation after making changes just to the main package should be much faster.

Installing TheIDE into Linux Desktop Menu

This part only applies to Linux. Now having TheIDE running, it is a good time to install it to your desktop menu by invoking this menu item:

Image 11

This creates ~/.local/share/applications/theide.desktop file, which should bring TheIDE into Programming submenu of your Linux desktop.

How to Start the New Project

To start writing your own code, you should choose MyApps assembly, which is reconfigured to place your newly created package into MyApps directory.

Image 12

Now press the "New package" button and you will get into "Create new package" mini-wizard.

Image 13

For this test, we will choose U++ Basic CtrlLib application which basically means GUI application without the pregenerated code for the main window class. So it just adds correct dependencies to our main package and provides really minimal boilerplate code. To finish the lecture, all we do for now is to insert:

C++
PromptOK("Hello world!");

into the GUI_APP_MAIN block:

Image 14

and invoke "Execute" just like with Days example:

Image 15

Congratulations, you have just compiled your first U++ application!

UppHub

The new feature of U++ 2021.1 is UppHub , system that allows easy integration of 3rd party modules (libraries) with U++ projects. This is similar to package management system like PyPI (for Python), NuGet (for C#) or vcpkg (for C/C++). Thanks to existing U++ modular system, the integration in TheIDE is really seamless.

The access to UppHub dialog is through the button in package selection dialog

Image 16

or through the menu entry Setup / UppHub..

Image 17

Install button clones the source repository to a location that is made visible to U++ package system which makes it instantly possible to use installed packages in your project. Check the full UppHub documentation here.

 

What is Next

If you have followed as far as here, chances are you might be slightly interested about U++ and wonder what to do next. Well, the recommended path to get more familiar with U++ is to check and try reference examples:

Image 18

These are small code snippets demonstrating most aspects of U++ framework as they are intended to be used. Just browse through the list, load what interests you and run it. Of course, there is also a website with documentation, tutorials and forums, where people are eager to solve all your problems with U++.

 

Useful Links

History

  • 1st September, 2020: Initial version
  • 15th September, 2020: Fixed formatting inconsistencies
  • 8th October, 2020: Table of contents added
  • 21st October, 2020: Updated with information for the 2020.2 release
  • 23st May, 2021: Updated for 2021.1 release
  • 27st May, 2021: Updated for 2021.2 release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)