[Temporarily Solved] Issues with Arduino Pro IDE

Edited Version:

Hello,

Thank you for reading this.

Please note: The issue I’m about to describe does not get replicated while I use the “simple” Arduino IDE.

Issue: I get ‘Unknown type name’ error for a variable I’m using even though I’ve included the appropriate library. The library is “Adafruit MPR121.”

Code:

#include "Adafruit_MPR121.h" //this line references the library needed for the touch IC breakout. 

Adafruit_MPR121 cap = Adafruit_MPR121 (); //assigning variable for the touch sensor

Error message:
Unknown type name 'Adafruit_MPR121’clang(unknown_typename)

Older Version:

Hello,

Thank you for reading this.

Please note: The issue I’m about to describe does not get replicated while I use the “simple” Arduino IDE.

Issue: I get ‘Unknown type name’ error for a variable I’m using even though I’ve included the appropriate library. The library is “Adafruit MPR121.”

pictures:

Does anyone happen to know how to fix this?

Fix it? I can’t even read it.
Please copy & paste the message in the forum using the code tags button, </> on the menu.

One pasted, it’s Helpful also to do CTRL-A (select all) and then use Ao button to remove the color formatting.

Fixed (please let me know if I need to change anything else about it).

Most likely, the library is either not installed, or installed in the wrong place.

Under Arduino IDE Tools, choose "manage libraries" to make sure you have it, and if not, install it.

1 Like

jremington:
Most likely, the library is either not installed, or installed in the wrong place.

Under Arduino IDE Tools, choose "manage libraries" to make sure you have it, and if not, install it.

I thought that too, but the library manager shows it as installed.

As far as I can see, the Pro IDE uses a different compiler than the IDE. So this might be a compiler related issue.

A google search for clang(unknown_typename) shows similar errors and gives some possible workarounds; not sure if they will work for this specific issue.

I suggest to report the issue at https://store.arduino.cc/store-support; they seem to react quite quickly.

I just gave it a try with Arduino Pro IDE 0.0.6 and Adafruit MPR121 1.0.5 and it works just fine for me.

Are you using those versions @ArianKS?

It's possible to get this type of error when there are multiple libraries containing the files that match an #include directive and the IDE picks a different library than you intended. You might say that it's unlikely two libraries will contain such a specific filename as Adafruit_MPR121.h, but it happens.

Please do this:

  • Sketch > Verify/Compile
  • After the compilation finishes, click the Arduino Pro IDE's output pane.
  • Press Ctrl + A to select all the output (and everything else in the Pro IDE window unfortunately).
  • Press Ctrl + C to copy the selected text to the clipboard
  • Open a text editor.
  • Press "Ctrl + V". This will paste the copied text into the text editor.
  • Save the file somewhere convenient.
  • In this forum thread, click the "Reply" button.
  • Click the "Attachments and other options" link. Normally I recommend people always post output directly to the forum thread when possible, but I think it's very unlikely the Arduino Pro IDE's output will ever be under the forum's 9000 character limit, so I won't even bother with that.
  • Click the "Choose Files" button.
  • Select the text file you saved.
  • Click the "Open" button. The text file containing the output will now be attached to the forum thread reply.
  • Add a bit of text to the reply to satisfy the requirement that every reply contains text and then click the "Post' button.

sterretje:
I suggest to report the issue at https://store.arduino.cc/store-support; they seem to react quite quickly.

Although I do recommend using the support form @sterretje recommended for reporting problems with the Arduino website and its content (other than Arduino Language Reference), when it comes to reporting software bugs you will likely get better results by reporting issues to the issue tracker of the project's repository, in this case:

The reason is this will bring the issue immediately to the attention of the developers of that project, rather than needing to work its way through several levels from the support staff (who don't have any ability to fix bugs). For administrative reasons too boring to talk about even if I was allowed to, this is even more the case for the Arduino Pro IDE

The situation is different with the Arduino website because none of that code/content is hosted in public repositories (with the exception of the Arduino Language Reference), so there is no directly relevant GitHub issue tracker to report to.

Thank you so very much for the detailed response. I have attached the file here.

Arduino_Output.txt (61.2 KB)

OK, so I can see from the output that the correct library is being used and your code is compiling, so this is a problem with what I believe is called the "language server" (the Pro IDE's version of Intellisense), which is supposed to identify problems in your code. This doesn't happen for me with a minimal sketch that contains the lines of code you shared.

If you restart the Pro IDE, does the problem still occur?

If so, please post your full sketch. It may be that some later code in your sketch is somehow breaking the language server.

Got it. The code is fairly long so I had to attach it. If there’s a preferred way I can share the code with you, please let me know. Thank you again.

V4.3a.ino (45 KB)

variables.h (3.99 KB)

OK, the problem was not related to anything in your sketch, but using your sketch allowed me to reproduce the problem purely by chance. It turns out that the issue only occurs when the sketch is saved to a location outside your user directory/sketchbook. When I was trying to reproduce the issue earlier, I was using a sketch inside my user directory, and so the language server was working fine. When I downloaded your sketch, it happened to be outside my user directory, and so the problem occurred.

So the workaround is to move your sketch to your user directory (/Users/ariankolahi-sohrabi/Documents/Arduino in this case). It can be in a subdirectory, but it just needs to be somewhere under that location.

I have submitted a bug report:

Thanks for bringing this issue to our attention @ArianKS! I think it's important for the Pro IDE to provide full support for sketches in any location.

Out of curiosity, Would the problem still occur if using angle brackets Instead of double quotes for the include?

The sketch I used for the demonstration in my bug report uses angle brackets and still has the same problem.

thanks - appreciated

So it’s not just a bug related to some sort of black magic done by the IDE in looking up the .h file in one place and clang looking elsewhere

I think there's a good chance it's something like that.

The truth is that I don't have very much experience with the Arduino Pro IDE (though I do have a lot of experience with Arduino CLI, which handles all the Arduino-specific stuff for the Pro IDE under the hood via a gRPC server). I tend to mirror what the forum users are doing, and so far there hasn't been a lot of posts about the Pro IDE on the forum. I'm sure we'll start seeing it more here as time goes on and it reaches a production release.

pert:
OK, the problem was not related to anything in your sketch, but using your sketch allowed me to reproduce the problem purely by chance. It turns out that the issue only occurs when the sketch is saved to a location outside your user directory/sketchbook. When I was trying to reproduce the issue earlier, I was using a sketch inside my user directory, and so the language server was working fine. When I downloaded your sketch, it happened to be outside my user directory, and so the problem occurred.

So the workaround is to move your sketch to your user directory (/Users/ariankolahi-sohrabi/Documents/Arduino in this case). It can be in a subdirectory, but it just needs to be somewhere under that location.

I have submitted a bug report:
Types defined in libraries not recognized by language server when sketch is outside user directory · Issue #274 · arduino/arduino-pro-ide · GitHub

Thanks for bringing this issue to our attention @ArianKS! I think it's important for the Pro IDE to provide full support for sketches in any location.

Thank you for the suggestion. I did what you mentioned, and now I'm getting the same error for the SD library :frowning:

Are you still getting the error even with sketches saved to your user directory?

pert:
Are you still getting the error even with sketches saved to your user directory?

Yep—but not the exact same errors. While the error for the "Adafruit MPR121" library is resolved, I get the same error for the "SD" library now.

It's a related issue. From your output:

Using library SD at version 1.2.3 in folder: /Applications/Arduino.app/Contents/Java/libraries/SD

I can see that the SD library is located in your classic Arduino IDE installation. Although the Pro IDE's compilation system has no problem with that, the language server can't deal. So the solution is to use Library Manager to install the SD library, which will put a copy of it in your user directory:

  • Tools > Manage Libraries...
  • In the "Filter your search..." field, type "sd".
  • Press Enter.
  • Scroll down through the list of results until you see "SD by Arduino, SparkFun". If it doesn't show up, just keep trying various searches and restarting the Pro IDE over and over again until by some miracle it does show up in the search results (something seems to be very broken with the Pro IDE's Library Manager).
  • Hover the mouse pointer over "SD by Arduino, SparkFun".
  • Click the "Install" button.
  • Restart the Pro IDE (the language server doesn't update after installing the library).

pert:
It’s a related issue. From your output:

Using library SD at version 1.2.3 in folder: /Applications/Arduino.app/Contents/Java/libraries/SD

I can see that the SD library is located in your classic Arduino IDE installation. Although the Pro IDE’s compilation system has no problem with that, the language server can’t deal. So the solution is to use Library Manager to install the SD library, which will put a copy of it in your user directory:

  • Tools > Manage Libraries…
  • In the “Filter your search…” field, type “sd”.
  • Press Enter.
  • Scroll down through the list of results until you see “SD by Arduino, SparkFun”. If it doesn’t show up, just keep trying various searches and restarting the Pro IDE over and over again until by some miracle it does show up in the search results (something seems to be very broken with the Pro IDE’s Library Manager).
  • Hover the mouse pointer over “SD by Arduino, SparkFun”.
  • Click the “Install” button.
  • Restart the Pro IDE (the language server doesn’t update after installing the library).

Thank you for the reply! I’ve searched for the SD library in the manager and have restarted the app 5 times or so now—but the library doesn’t show up. Is there a way I can “manually” copy/ move the SD library folder to the correct location?