Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just Can't Solve includePath errors #1750

Closed
GreenChileSteakandEggs opened this issue Mar 28, 2018 · 19 comments
Closed

Just Can't Solve includePath errors #1750

GreenChileSteakandEggs opened this issue Mar 28, 2018 · 19 comments
Labels
fixed Check the Milestone for the release in which the fix is or will be available. Language Service question

Comments

@GreenChileSteakandEggs
Copy link

GreenChileSteakandEggs commented Mar 28, 2018

I'm writing Arduino sketches and trying to switch over to VS Code for the de-bugging features. I can get the blink example to load and get NO errors.

When I load my own sketch that located in the C:/Users/ directory, then I get the "cannot open source file" error. I have read everything concerning this issue, but just can't solve it.

Any help is greatly appreciated. I've banged my head long enough.

Here are my versions,
VS Code - 1.21.1
Windows10
Arduino Extension 0.2.11
C/C++ Extension 0.15.0

Here's the error,
#include errors detected. Please update your includePath. IntelliSense features for this translation unit (C:\Users\Greg\Projects\2018\Humidity Sensor\Source Code\HT18\HT18.ino) will be provided by the Tag Parser.

And lastly, here is my c_cpp_properties.json file,

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_GFX-Library",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_ILI9341",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_STMPE610",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_AM2315",
                    "C:\\Users\\Greg\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.6.18\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\SD",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\Wire",
                    "C:\\Users\\Greg\\Projects\\2018\\HumiditySensor\\SourceCode\\HT18\\HT18.ino"

            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": false,
                "path": [
                    "${workspaceFolder}",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_GFX-Library",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_ILI9341",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_STMPE610",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_AM2315",
                    "C:\\Users\\Greg\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.6.18\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\SD",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\Wire",
                    "C:\\Users\\Greg\\Projects\\2018\\HumiditySensor\\SourceCode\\HT18\\HT18.ino"

                ]
            },
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 3
}
@mtripp100
Copy link

#include errors detected. Please update your includePath. 

Your posted config does now have an includePath, only a browse/path - have you set it elsewhere?

@GreenChileSteakandEggs
Copy link
Author

GreenChileSteakandEggs commented Mar 28, 2018

Don't know why that didn't come thru. But, yes I have the includPath above the browse/path. Let me post again. Thanks for the reply.

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_GFX-Library",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_ILI9341",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_STMPE610",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_AM2315",
                    "C:\\Users\\Greg\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.6.18\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\SD",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\Wire",
                    "C:\\Users\\Greg\\Projects\\2018\\HumiditySensor\\SourceCode\\HT18\\HT18.ino"

            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": false,
                "path": [
                    "${workspaceFolder}",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_GFX-Library",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_ILI9341",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_STMPE610",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\Adafruit_AM2315",
                    "C:\\Users\\Greg\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.6.18\\cores\\arduino",
                    "C:\\ProgramFiles(x86)\\Arduino\\libraries\\SD",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI",
                    "C:\\ProgramFiles(x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\Wire",
                    "C:\\Users\\Greg\\Projects\\2018\\HumiditySensor\\SourceCode\\HT18\\HT18.ino"

                ]
            },
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 3
}

@GreenChileSteakandEggs
Copy link
Author

My apologies, but when I copy and paste the code over, it only put half of it into the gray box. When I figure this issue out, I'll post the full c_cpp_properties.json file.

New to GitHub

@bobbrow
Copy link
Member

bobbrow commented Mar 28, 2018

use 3 backticks (`) when marking multiple lines of "code". I will edit your comments so that they show up properly.

@bobbrow
Copy link
Member

bobbrow commented Mar 28, 2018

Try setting the "intellisenseMode" to "clang-x64". If you still have #include errors after that, please let us know which files the extension is unable to find.

@GreenChileSteakandEggs
Copy link
Author

GreenChileSteakandEggs commented Mar 28, 2018

I tried 3 back ticks and it still didn't show all. Thanks.

I changed the intellisensenMode to clang-x64 and these are the files unable to find,

#include <SPI.h>;
#include<Wire.h>;
#include<Adafruit_GFX.h>;
#include<Adafruit_ILI9341.h>;
#include<Adafruit_STMPE610.h>;
#include<SoftwareSerial.h>;
#include<SD.h>;
#include<Adafruit_AM2315.h>;

It's not finding any libraries.
Just for reference, this code does compile and upload with the Arduino IDE.

@bobbrow
Copy link
Member

bobbrow commented Mar 28, 2018

Where do those files live in your filesystem? Are those paths included in the "includePath" setting? Or is this a green squiggle and you need to hover over it to see which dependency of these header files cannot be found?

@bobbrow
Copy link
Member

bobbrow commented Mar 28, 2018

Oh wait, I missed something. Your include path appears to be missing spaces in C:\\Program Files (x86)\\...

@GreenChileSteakandEggs
Copy link
Author

OK, now I'm getting somewhere. You were correct. I was missing spaces in those C://Program Files (x86)

Added spaces and still have errors but they have Cannot open source file "stdlib.h" (dependency of "SPI.h")

I have the SPI.h library path added to the includePath and the browse path

The files live in the paths that are shown in the above posts. If I understand your question correctly.

@bobbrow
Copy link
Member

bobbrow commented Mar 28, 2018

ok, if it can't find stdlib.h, then it probably means the "includePath" is missing your system includes. We are making a change in 0.16.0 to remove the requirement to put system includes in the "includePath" if you point us to your compiler via the new "compilerPath" property. You can try out the insiders build if you want a preview, but we are hoping to release the final package sometime today.

If you would rather wait for the final release, you can run [compiler] -v -E -x c++ nul to see what your system include paths are and add them to the "includePath" yourself.

@GreenChileSteakandEggs
Copy link
Author

I'll wait for the final release. Thanks for the help.

@bobbrow bobbrow added question Language Service fixed Check the Milestone for the release in which the fix is or will be available. labels Mar 28, 2018
@GreenChileSteakandEggs
Copy link
Author

I've added the paths as highlighted in red, but still getting errors. What's the proper paths?

edit gcc include paths

@GreenChileSteakandEggs
Copy link
Author

OK, forget the above post. Everything is working. No Errors.

This article was helpful,
http://cuneyt.aliustaoglu.biz/en/enabling-arduino-intellisense-with-visual-studio-code/

Why I couldn't find that a couple of days ago .... : )

Thank you Bob for your help.

@bobbrow
Copy link
Member

bobbrow commented Mar 29, 2018

Oh, it's interesting that that article says to set "C_Cpp.intelliSenseEngine": "Tag Parser". That is the degraded IntelliSense experience, but it's probably what made your squiggles go away.

@razed11
Copy link

razed11 commented Apr 13, 2018

MacOS   : 10.13.4
VS Code  : 1.22.1
CPP Tools: 0.16.1

I was have a similar issue--embedded project using ARM GCC tools and libraries with many associated headers. Setting "C_Cpp.intelliSenseEngine": "Tag Parser" fixed this for me.

In my case I had a directory lib that was one level above ${workspaceFolder} so I set browse.path to include this. I also tried added to includePath. Only after I set Tag Parser did it begin working.

            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "${workspaceFolder}/../lib",
                    "/usr/local/include"
                ],

I'm pretty happy now but is this a bug? It now seems to be finding symbols that are defined deep in that lib directory but I wouldn't want miss out on the "un-degraded" IntelliSense experience.

@bobbrow
Copy link
Member

bobbrow commented Apr 13, 2018

@razed11 did you try setting the "compilerPath" property to point to your ARM GCC compiler? That should pick up the system include path and defines necessary to make the Default IntelliSense work better. You can even add additional compiler arguments to the "path" string and we'll forward them on when we query the compiler.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Apr 13, 2018

@razed11 Also, the includePath used by the "Default" intelliSenseEngine is not recursive (yet), if your missing includes were under your ${workspaceFolder} or lib..

@bobbrow bobbrow closed this as completed Apr 24, 2018
@redquartista
Copy link

redquartista commented Apr 23, 2019

[issue moved to #3512]

@bobbrow
Copy link
Member

bobbrow commented Apr 23, 2019

@redquartista, I moved your comment to a new issue. Please use that instead of this one.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed Check the Milestone for the release in which the fix is or will be available. Language Service question
Projects
None yet
Development

No branches or pull requests

6 participants