NI Linux Real-Time Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Archived: NI Linux Real-Time Cross Compiling: Using the NI Linux Real-Time Cross Compile Toolchain with Visual Studio Code

Note: This document is now archived and is no longer being updated. For the most up-to-date C/C++ Tutorials for NI Linux Real-Time, visit ni.com/info and enter the Info Code NILRTCrossCompile.

.


Overview

This series of tutorials provides an introduction to compiling C/C++ code using the NI Linux Real-Time GNU C/C++ Toolchains and Visual Studio Code. The attached documents introduce the concept of cross compiling, provide instructions on how to configure third-party tools and Visual Studio Code as an example of tools for use with the NI toolchain, and walk through several example use cases such as a "Hello, World!" application. 

 

For an alternative approach, refer to Developing C/C++ Code for NI Linux Real-Time with the Visual Studio Code Remote Development Extensio....

 

Description

The tutorial documents attached to this page cover a large range of topics related to building and deploying C/C++ code to NI Linux Real-Time devices. The tutorials are as follows:

  • Part 1: Cross Compiling C/C++ Code for NI Linux Real-Time
    • This document introduces the NI Linux Real-Time Cross Compile Toolchain and basic cross compiling concepts.
  • Part 2: Configuring a Development System with Visual Studio Code and the NI Linux Real-Time Compilers
    • This document covers the third-party tools used in the tutorials and how to set them up. Note that these tools are simply examples of what can be used with the toolchain. 
  • Part 3: Configuring Visual Studio Code for Building NI Linux Real-Time Code
    • This document covers the editor configuration in Visual Studio Code to integrate with the tools used in the tutorials. 
  • Part 4: "Hello, World!" with Visual Studio Code and NI Linux Real-Time
    • This document covers compiling, deploying, and debugging a simple "Hello, World!" application. 
  • Part 5: Building a Shared Library with Visual Studio Code and NI Linux Real-Time
    • This document covers compiling a simple shared library.
  • Part 6: Calling and Debugging a Shared Library with Visual Studio Code and NI Linux Real-Time
    • This document covers compiling, deploying, and debugging a simple application which calls the shared library created in Part 5.

Hardware and Software Requirements

The requirements for each tutorial differ, but in general all tutorials require a system configured as described in Part 2 - Configuring a Development System with Visual Studio Code and the NI Linux RT Compilers and in Part 3 - Configuring Visual Studio Code for Building NI Linux RT Code. Debugging or deploying code additionally requires a system running NI Linux Real-Time with software installed. 

Charlie J.
National Instruments
Comments
Russell_G.
Member
Member
on

On Part 6, step 6, I get the following error:

 

 

header_error_1.png

 

I have confirmed that I have I have ‘myLib.h’ in the proper directory:

 

 

header_error_2.png

 

And I believe my c_cpp_properties.json is set correctly:

 

 

header_error_3.png

 

Any ideas on what could be causing the issue?  Thanks for any help you can provide!

 

 

ej
Member
Member
on

@Russell_G, I know this potential solution comes 3 months late late, but I just finished tutorial and ran into the same problem.  Hopefully this helps someone else (or prompts a correction to the material).  The problem is not from the c_cpp_properties.json file; the error is in the CMakeList.txt file.  You'll find that there is a nomenclature change from 'toolchainpath' in Part 3 to 'toolchain_path' in Part 6.  If you built your file with 'toolchainpath' as the sysroot location variable, you'll run into this problem.  I ended up catching this error early when I compared my CMakeList file to the one that came as an attachment to the tutorial (the attachment file uses the underscore '_').  See the screenshots below:

 

Part 3 Instructions:

ej_3-1631088090095.png

 

Part 6 Instructions:

ej_0-1631086632508.png

 

This is an excellent tutorial, but this discrepancy should be fixed.  Although, it did help me understand a bit more what the files were all about when debugging this problem.