Skip to content

uint8_t undefined with arm-none-eabi toolset #1484

@sean-mcmanus

Description

@sean-mcmanus

Moved from issue #916 (comment) by @aakre.

@sean-mcmanus Thanks for getting back to me on this. I tried adding GNUC, __GNUC__, __GNUC__=7 and even __GNUC_MINOR__=2 and __GNUC_PATCHLEVEL__=1 in several combinations but my integers are still undefined.

So I tried to construct a minimal example with this issue to investigate further (apologies for the long post)
My source code:

#include <stdint.h>

int main()
{
    uint8_t x = 8;
    uint16_t y = 16;
    uint32_t z = 32;

    return 0;
}

With default includePath and browsePath, I get no errors and if I hover the types I get:

typedef unsigned char uint8_t
typedef unsigned short uint16_t
typedef unsigned int uint32_t

which are defined in /usr/lib/gcc/x86_64-linux-gnu/5/include/stdint-gcc.h.

Then I replace the default paths with my toolchain headers:

"includePath": [
                "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/c++/7.2.1",
                "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/c++/7.2.1/arm-none-eabi",
                "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/c++/7.2.1/backward",
                "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include",
                "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed",
                "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include",
                "${workspaceRoot}",
            ]

"browse": {
                "path": [
                    "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/c++/7.2.1",
                    "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/c++/7.2.1/arm-none-eabi",
                    "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/c++/7.2.1/backward",
                    "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include",
                    "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed",
                    "/usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include",
                    "${workspaceRoot}"
                ]

Then uint8_t and uint16_t gets a red squiggle and is marked as undefined. uint32_t is fine and if I hover I get: typedef __uint32_t uint32_t.
Hitting F12 leads me to /usr/lib/gcc/arm-none-eabi/7.2.1/include/stdint-gcc.h.

Now here is the strange part:
When I define "__GNUC__" it sometimes work. I say sometimes, because I cannot reproduce this accurately. I've tried to create a blank project with the steps mentioned above a couple of times, and sometimes intellisense identifies uint8_t as __UINT8_TYPE__ and uint16_t as __UINT16_TYPE__.
However, the times it worked it only worked once, because when I closed vscode and reloaded the project, I was left with red squiggles.

This is so strange that there must be something wrong somewhere else I guess, but I have absolutely no idea what.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions