-
Notifications
You must be signed in to change notification settings - Fork 236
identifier "Serial1" is undefined C/C++(20) #1299
Comments
Hi Guy! In your code, you writed wrong. |
I actually did not ! Arduino Leonardo has 'Serial1' . 'Serial' is the cable port. I am using the TX/RX pins for streaming through another device. Thank you for your answer. |
@wbadry I have the same issue with the Mega board (need to access Serial Serial1 and Serial2) |
I am having this same issue with "MightyCore" and Serial1. I don't much like the quick-fix provided above. Hoping adding traffic to this issue will lead to a better solution. EDIT: So, the linked solution above didn't actually solve my problem but a little lower down was this which after I added the "-mcu=atmega324" to my compilerargs intellisense was fine. |
I have same problem. My Env is: |
This was driving me insane, but I found a solution that would survive intellisense config rebuild by adding the following option inside your {
...
"buildPreferences": [["build.extra_flags", "-D__AVR_ATmega2560__"]]
} You can find macros for your board here. EditSwapped |
Another logI have the same problem with these specs SpecsVS Code - 1.64.0
Code
Erroridentifier "Serial2" is undefined |
@JakePorter05 Did you try using my solution? |
@h3xcat Yes your fix worked, but since this is a very mainstream board it would be nice to have it fixed as it still is a bug that shouldn't need a manual modification by the developer. |
@h3xcat Thank you. Adding the "buildPreferences" line to arduino.json fixed my many reported errors in intellisense as well. |
@h3xcat Thx so much. That buildPreferences trick worked beautifully!! |
i am using the @h3xcat trick, which used to work fine.
|
i've eliminated the error now like this:
That seems to make intellisense ignore individual lines. Everything compiles and works fine. |
OS: Windows 10 Version 21H1 (OS Build: 19.043.1081) / UBUNTU 20.04 LTS
VS Code: 1.57.1
Arduino IDE: 1.8.15
Arduino Extension: 0.4.3
Problem:
The
Serial1
is undefined. The code compiles with no issues though.arduino.json
c_cpp_properties.json
I tried the solution in #866 and unfortunately, the verification overrides the setting and
Serial1
remains undefined.The text was updated successfully, but these errors were encountered: