I installed the Arduino extension Arduino extension in VSCode which is supposed to include intellisense however it doesn't seem to be working. This is my c_cpp_properties.json:
And here is an example of the intellisense not working:
As you can see, intellisense should be able to predict the keyword Serial however it does not.
I have Command Line Tools installed. Is there a missing directory that I should include in the "includePath" property.
add the missing lines into your c_cpp_properties.json (and change some filename to mac equivalent)
especially with "defines": [ "USBCON" ] to make Serial class to work with intellisense
{
"configurations": [
{
"name": "Win32",
"includePath": [
"<arduino ide installation folder>\\tools\\**",
"<arduino ide installation folder>\\hardware\\arduino\\avr\\**",
"<arduino ide installation folder>\\hardware\\tools\\**",
"<arduino ide installation folder>\\hardware\\arduino\\avr\\cores\\arduino"
],
"forcedInclude": [
"<arduino ide installation folder>\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h"
],
"intelliSenseMode": "msvc-x64",
"compilerPath": "<arduino ide installation folder>\\hardware\\tools\\avr\\bin\\avr-gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"defines": [
"USBCON"
]
}
],
"version": 4
}
Try addding this paths to "browse" as in "includePath"
"browse": {
"limitSymbolsToIncludedHeaders": false,
"path": [
"arduino_install_dir/hardware/tools/avr/avr/include",
"${workspaceRoot}"
]
},
Related
This is the error message I got when I first run 'vagrant provision' (after command 'vagrant up' blocked in 'Mounting NFS shared folders...') under the trellis directory:
TASK [wordpress-install : Install Dependencies with Composer] ******************
System info:
Ansible 2.9.11; Vagrant 2.2.9; Linux
Trellis version (per changelog): "Removes ID from Lets Encrypt bundled certificate and make filename stable"
---------------------------------------------------
Composer could not find a composer.json file in /srv/www/example.com/current
To initialize a project, please create a composer.json file
as described in the https://getcomposer.org/ "Getting Started"
section failed: [default] (item=example.com) =>
{
"ansible_loop_var": "item",
"changed": false,
"item": {
"key": "example.com",
"value": {
"admin_email": "admin#example.test",
"cache": {
"enabled": false
},
"local_path": "../site",
"multisite": {
"enabled": false
},
"site_hosts": [
{
"canonical": "example.test",
"redirects": [
"www.example.test"
]
}
],
"ssl": {
"enabled": false,
"provider": "self-signed"
}
}
},
"stdout": "Composer could not find a composer.json file in /srv/www/example.com/current\nTo initialize a project, please create a composer.json file as described in the https://getcomposer.org/ \"Getting Started\" section\n",
"stdout_lines": [
"Composer could not find a composer.json file in /srv/www/example.com/current",
"To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ \"Getting Started\" section"
]
}
PLAY RECAP *********************************************************************
default : ok=125 changed=83 unreachable=0 failed=1 skipped=34 rescued=0 ignored=0
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
How do I fix this? Where to find the right composer.json for Trellis, Bedrock, and Sage for local development on Linux?
Ubuntu 19.10
I've set c_cpp_properties.json to be:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/Cellar/qt/5.13.2/include/QtCore"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
it reports: include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/Users/.../.cpp).C/C++(1696)
cannot open source file "QtCore/qstring.h" (dependency of "QTime")```
The compiler is looking for "QtCore/qstring.h". Based on the include path you've already specified I guess that will be under...
"/usr/local/Cellar/qt/5.13.2/include"
So you need to add that to your list of include paths.
add
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
to your config file.
See Visual Studio Code on macOS + Qt + Intellisense
I'm trying to program arduino in vscode. The problem is that It's giving me weird header errors:
cannot open source file "avr/pgmspace.h" (dependency of "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\Arduino.h")
This is my arduino.json:
"board": "arduino:avr:uno"
}
This is my c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"C:\\Program Files (x86)\\Arduino\\tools\\**",
"C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**"
],
"forcedInclude": [
"C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h"
],
"intelliSenseMode": "msvc-x64",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
It should recursively include all of the required libraries, and even if imanually try to add the path to avr/pgmspace.h or its directory, it keeps giving me the same errors.
How do I solve this error?
Based on the responses to this issue, I added "c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\**" to my include path in c_cpp_properties.json:
"includePath": [
"c:\\Program Files (x86)\\Arduino\\tools\\**",
"c:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**",
"c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\**"
],
For anyone who stumbles here on a Mac, here is the config that works for me with the Uno:
{
"env": {
"arduino_path": "/Applications/Arduino.app/Contents/Java",
"arduino_avr_include_path": "${env:arduino_path}/hardware/arduino/avr",
"arduino_avr_include2_path": "${env:arduino_path}/hardware/tools/avr/avr/include",
"arduino_avr_compiler_path": "${env:arduino_path}/hardware/tools/avr/bin/avr-g++"
},
"configurations": [
{
"name": "Mac",
"defines": [
"ARDUINO=10810",
"__AVR_ATmega328P__",
"UBRRH"
],
"includePath": [
"${workspaceRoot}",
"${env:arduino_avr_include_path}/**",
"${env:arduino_avr_include2_path}/**"
],
"forcedInclude": [
"/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h"
],
"intelliSenseMode": "gcc-x64",
"cStandard": "c11",
"cppStandard": "c++11",
"compilerPath": "${env:arduino_compiler_path} -std=gnu++11 -mmcu=atmega328p"
}
],
"version": 4
}
The key to finding <avr/pgmspace.h> was the adding the hardware/tools/avr/avr/include path.
Defining ARDUINO=10810 was identified from the output of running Arduino: Verify with the verbose flag.
Defining __AVR_ATmega328P__ was added to allow proper IntelliSense completion of the raw register macros (e.g. _BV(), OCR0A, TIMSK0, etc.); the correct macro to define was identified based on the chip being an ATMEGA328P-PU and by inspection of the file hardware/tools/avr/avr/include/avr/io.h.
The compilerPath value looks wrong, although it is only used by the IDE and not for target compilation. The documentation says :
The absolute path to the compiler you use to build your project. The extension will query the compiler to determine the system include paths and default defines to use for IntelliSense.
In any case I recommend to configure it properly, I was able to remove
"${HOME}/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/../lib/gcc/avr/5.4.0/include",
"${HOME}/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/../lib/gcc/avr/5.4.0/include-fixed",
"${HOME}/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/../lib/gcc/avr/5.4.0/../../../../avr/include"
when setting
"compilerPath": "${HOME}/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -std=gnu++11 -mmcu=atmega328p",
To figure out the exact compiler that is used turn on verbose logging in the output window:
File -> Preferences -> Settings -> Extensions -> Arduino configuration -> Log level -> verbose
which in this case also should help you figure out why the compiler does not pick up avr/pgmspace.h.
Here are my arduino.json
{
"board": "arduino:avr:uno",
"port": "/dev/ttyUSB0",
"sketch": "src/myproject.ino",
"output": "../build"
}
and c_cpp_properties.json
{
"env": {
"arduino.path": "${HOME}/.arduino15/packages/arduino",
"arduino.avr.include.path": "${env:arduino.path}/hardware/avr/1.6.23",
"arduino.avr.compiler.path": "${env:arduino.path}/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++",
"arduino.libraries.path": "${HOME}/arduino/sketchbook/libraries",
"dummy-last-line": "To allow the second to last line (e.g. the real last line) to always end with a comma"
},
"configurations": [
{
"name": "Linux",
"includePath": [
"./src",
"./test",
"../arduino_ci/cpp/unittest",
"${env:arduino.libraries.path}/SmartLCD",
"${env:arduino.libraries.path}/Chronos/src",
"${env:arduino.libraries.path}/Time",
"${env:arduino.libraries.path}/RTClib",
"${env:arduino.avr.include.path}/libraries/Wire/src",
"${env:arduino.avr.include.path}/cores/arduino",
"${env:arduino.avr.include.path}/variants/standard"
],
"browse": {
"path": [
"${workspaceFolder}/src"
],
"limitSymbolsToIncludedHeaders": true
},
"defines": [
"UBRRH"
],
"intelliSenseMode": "gcc-x64",
"compilerPath": "${env:arduino.avr.compiler.path} -std=gnu++11 -mmcu=atmega328p",
"cStandard": "c11",
"cppStandard": "c++11"
}
],
"version": 4
}
(the UBRRH define is for the Serial variable in HardwareSerial.h)
I 'm trying to debug a Deno project, but I dont know, how to debug this on Windows 10 using the lldb debugger as the documentation says.
The LLDB, on windows 10 seems to be not so easy to install.
///reference path="../../deno.d.ts"
import * as deno from 'deno';
import { color } from 'https://deno.land/x/colors/main.ts';
const s = new Set();
[*] s.add('test')
console.log(s);
[*] <-- a breakpoint
In order to debug with Deno:
Add somewhere in your code a debugger; line of code.
Run with --inspect-brk flag. deno run --inspect-brk ... or deno test --inspect-brk ... to debug tests.
Open chrome://inspect page on Chrome.
On the Remote Target section press to "inspect".
Press the Resume script execution button, the code will pause just in your breakpoint.
Reference: https://aralroca.com/blog/learn-deno-chat-app#debugging
If you use VSCode here is a launch.json I am using.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Deno",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "-A", "--inspect-brk", "index.ts"],
"port": 9229
}
]
}
I would like to create 4 build options for building Actionscript files. One for Building and one for Running in Linux, and the same for Windows.
Is it possible to do this?
Currently it seems 'windows' and 'linux' sections can only overwrite the default build option?
My current broken .sublime-build file is:
{
"selector": "source.actionscript",
"windows":
{
"cmd": [
"${packages}\\User\\Flash-build.bat",
"${project_path}",
"${file}"
],
"variants":
[
{
"name": "Run",
"cmd": [
"${packages}\\User\\Flash-run.bat",
"${file_path}",
"${file_base_name}"
]
}
],
},
"linux":
{
"cmd": [
"${packages}/User/Flash-build.sh",
"${packages}",
"${project_path}",
"${file_path}",
"${file_base_name}"
],
"variants":
[
{
"name": "Run",
"cmd": [
"${packages}/User/Flash-run.sh",
"${packages}",
"${project_path}",
"${file_path}",
"${file_base_name}"
]
}
]
}
}
Looking at the documentation, I can't see why your solution wouldn't work, however, I know that the following works for me.
Sublime preference files can be specified on a per-OS basis. You could create three separate files:
User/actionscript (OSX).sublime-build
User/actionscript (Linux).sublime-build
User/actionscript (Windows).sublime-build
Sublime will only pick up the one that is relevant to your OS.