MATLAB: When connecting to an Arduino board, how to fix errors that point towards the “c++config.h” file

Embedded Coder

I have an Arduino board that I am trying to use from MATLAB. When I try to connect to it using the following command:
>> arduino();
I get a lengthy error message that ends with the "c++config.h" file, and "No such file or directory" or similar. How do I fix this?

Best Answer

  • There are several steps that we can take to get past these types of errors.
    1) Reinstall the Arduino IDE, and install your specific Device support from the Arduino IDE.
    2) Then, please work through the Arduino Hardware Troubleshooting steps here:
    3) In the error that points to the "c++config.h" file, find the entire directory where that file is. It will look something like this:
    c:\programdata\matlab\supportpackages\r2018b_1\3p.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\arm-none-eabi\armv6-m\bits
    Copy the contents of the above folder (..\bits\) to this folder:
    c:\programdata\matlab\supportpackages\r2018b_1\3p.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits
    In essence we are removing these folders (or similar, intermediate, repeated folders) from the file path:
    arm-none-eabi\armv6-m
    Then restart MATLAB and run the connection command again. The board should connect successfully.