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

Vim: linter can't find the 'Arduino.h' file #808

Closed
lynndylanhurley opened this issue Oct 16, 2016 · 4 comments
Closed

Vim: linter can't find the 'Arduino.h' file #808

lynndylanhurley opened this issue Oct 16, 2016 · 4 comments
Milestone

Comments

@lynndylanhurley
Copy link

lynndylanhurley commented Oct 16, 2016

Configuration

Operating system:

Mac OS X 10.11.6

PlatformIO Version (platformio --version):

3.1.0

Description of problem

Using Vim, the neomake linter plugin can't seem to find the Arduino libs. Here is the complete output of the error.

This is the command that is run:

clang++ -fsyntax-only -Wall -Wextra /Users/lynnhurley/Code/ChainedSignal
s/surface_event_display/src/main.cpp

And this is the error:

clangtidy: 'Arduino.h' file not found [clang-diagnostic-error]

platformio run works just fine.

Steps to Reproduce

  1. platformio init --board megaatmega2560
  2. Paste blink code from the quickstart guide.
  3. Save src/main.cpp

Actual Results

The following error:

clangtidy: 'Arduino.h' file not found [clang-diagnostic-error]

Expected Results

There should be no linter errors.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino

Source file to reproduce issue:

/**
 * Blink
 *
 * Turns on an LED on for one second,
 * then off for one second, repeatedly.
 */
#include "Arduino.h"

void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);

  // wait for a second
  delay(1000);

  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);

  // wait for a second
  delay(1000);
}

Additional info

I guess the main questions are:

  1. The neomake linter wants to use clang++ by default. Is this correct, or should neomake be using a different system for linting?
  2. If clang++ is the correct linter, what is the best way to tell clang++ where the platformio libraries are located?
  3. If clang++ is not the correct linter, what commands should neomake be running instead?
@ivankravets
Copy link
Member

You see this error because didn't specify CPPPATH.

PlatformIO Build System has this data and other IDEs use it. For example, check pio run -t idedata. Does neomake allow to specify custom CPPPATH?

@lynndylanhurley
Copy link
Author

Oh nice, I didn't know about that command. I'll see what I can do with that, thanks @ivankravets!!

@coddingtonbear
Copy link

I'm sure you've already found a suitable answer, @lynndylanhurley, but for future readers, I've written a simple plugin for solving this problem in a general way.

Cheers!

@ivankravets ivankravets added this to the 3.2.0 milestone Dec 4, 2016
@ivankravets
Copy link
Member

@coddingtonbear thanks a lot for your plugin! I've just added it to PIO docs http://docs.platformio.org/en/latest/ide/vim.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants