Events

:

:

Elektronik | Funk | Software

Der Technik-Blog

  • Social Media

    Werbung:


    New Posts


    Events

    • Keine zukünftigen Events vorhanden

    The Tech-Blog

    C++ Raspberry Pi Compiling

    C++ Compiling on Raspberry Pi

    Alex @ AEQ-WEB

    This article is about compiling a previously created CMake C++ project from Windows on a Raspberry Pi. With CMake as a cross-platform build tool, the "Hello World" example code can be compiled unchanged on different systems. The steps include installing the required software packages, creating a project directory, and finally using CMake and GCC to compile and run a C++ program on the Raspberry Pi.

    Installation of necessary software packages

    To compile the "Hello World" code on a Raspberry Pi, some essential software packages are required, including GCC, G++, and CMake. These tools can be installed via the Raspberry Pi package manager. After executing `apt-get update`, the following command installs the three necessary packages:

    Werbung:

    apt-get install gcc g++ cmake

    Description of the installed packages

    GCC (GNU Compiler Collection): GCC is a collection of compilers that support various programming languages such as C and C++. It enables the translation of source code into executable programs.
    G++ (GNU C++ Compiler): G++ is specifically designed for compiling C++ code. This compiler is used for the "Hello World" example in C++.
    CMake: CMake is a cross-platform build tool that simplifies the management of the compilation process. It helps organize project files efficiently and translate them across different systems.

    After installing these packages, the Raspberry Pi is ready for compiling and running the code.

    Creating a directory

    For a clear project structure, it is recommended to create a separate directory for the "Hello World" code and the associated build files. This makes it easy to organize all relevant files. After creating a new folder named "HelloWorld" in the directory (e.g., /home/pi), the files previously created on Windows (CMakeLists.txt & src/main.cpp) can be copied into this folder. To be able to compile the program, an additional "build" folder is created in the main directory.

    Werbung:

    Compiling the program

    With CMake, the code can now be compiled on the Raspberry Pi or another Linux computer. To do this, switch to the "build" folder in the console and execute the following commands:

    cmake ..
    make

    If the compilation was successful, the program can be started with the following command:


    ./HelloWorld


    Info: This page was automatically translated and may contain errors
    122X122

    About the Author

    Alex, the founder of AEQ-WEB. He works for more of 10 years with different computers, microcontroller and semiconductors. In addition to hardware projects, he also develops websites, apps and software for computers.

    Top articles in this category:

    Vaisala RS41 Radiosonde Firmware Flash

    Radiosonde RS41 Firmware Flash

    • Video
    • DE/EN

    Every day hundreds of meteorological radiosondes fall from the sky. In this article we convert a radiosonde into a GPS tracker for APRS, RTTY & CW

    read more
    SenseCAP T1000 Payload Decoder

    SenseCAP T1000 Payload Decoder

    • DE/EN

    Alternative payload decoder for the SenseCAP T1000 LoRaWAN GPS tracker. Compatible with TTN Mapper, LoWTrack and other apps.

    read more

    Social Media

    Werbung:


    New Posts


    Events

    • Keine zukünftigen Events vorhanden