microsoft / vscode-arduino

Visual Studio Code extension for Arduino
Other
1.17k stars 223 forks source link

[Bug] IntelliSense Error "os_random" not defined #1171

Closed miiiiiYT closed 3 years ago

miiiiiYT commented 3 years ago

I get the error Identifier ""os_random"" not defined in my current project:

void setup() {
    // for random generator
    randomSeed(os_random());

After 2+ hours of searching for a solution I couldn't find one. The code compiles fine, only IntelliSense makes trouble. I had the same issue with "Serial" but I solved that by writing a definition in my c_cpp_properties.json.

It looks like this:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\Users\\name\\AppData\\Local\\Arduino15\\packages\\deauther\\tools\\**",
                "C:\\Users\\name\\Documents\\Arduino\\libraries\\**",
                "C:\\Program Files (x86)\\Arduino\\libraries\\**",
                "C:\\Users\\name\\AppData\\Local\\Arduino15\\packages\\deauther\\hardware\\esp8266\\2.7.2\\**",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/variants/standard",
                "C:/Program Files (x86)/Arduino/**",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/EEPROM/",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/SPI/",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/SoftwareSerial/",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/Wire/",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include/",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include/avr/",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include/compat/",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include/util/",
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "USBCON"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            // "compilerPath": "C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-gcc.exe",
            "intelliSenseMode": "gcc-x64",
            "forcedInclude": []
        }
    ],
    "version": 4
}

It's a bit messy, as I tried fixing multiple things.

BTW I should note that this is not my code, but rather the repo eps8266_deauther by spacehuhn.

Thanks in advance.

adiazulay commented 3 years ago

IntelliSense auto-generation has been added in v0.4.0. If you're having any problems with IntelliSense please open a new issue.