Currently you would need to create an extension for Visual Studio for Mac to add a new project template. Then there are two options for how to create the project template. You can use the old templating engine which is documented on the MonoDevelop website. Or you can use the new.NET Core templating engine to create a NuGet package.
I've begun using VSC for my embedded C projects with gcc for ARM on a Mac. Having set up include paths in c_cpp_properties.json, most of my #includes are now working. However, a line such as this:
produces a red squiggly underline and the error:
The source file in question includes stdint:
and the includePath includes:
and:
(the only other option being msvc-x64).
The codebase compiles just fine when I use make and gcc. How do I show the C/C++ extension where uint32_t is?
Edit:
stdint.h looks like this:
and stdint-gcc.h contains:
This suggests __UINT32_TYPE__ is NOT defined when VSC is parsing my code, but it IS defined when I build with make and gcc.
Edit:
Following @mbmcavoy's answer I'm including my c_cpp_properties.json file here:
Edit:
On digging deeper, I found that gcc-arm-none-eabi-4_9-2015q3/lib/gcc/arm-none-eabi/4.9.3/include/stdint.h had __STDC_HOSTED__ defined and therefore stdint-gcc.h was not actually being included. Instead, that header does an 'include_next <stdint.h>', which finds gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/include/stdint.h. I still can't see where unint32_t is defined, either for gcc and make or for VSC.

2 Answers

After trying all of the proposed solutions to no effect, I consider the uint32_t issue to be a bug.
To solve the annoying warnings in VSCode, just add the following line after your #include section:
By doing this once in a single file, it fixes my VSCode warnings and still compiles.
wscourgeI have been able to resolve this on my machine (Windows), with three steps:
- Applying Compiler Defines to the C/C++ Extension
The question is correct when it states 'This suggests __UINT32_TYPE__ is NOT defined when VSC is parsing my code, but it IS defined when I build with make and gcc.' The ARM cross-compiler has many built-in defines that are not included in the clang-x64 parser.

First, find out defines your gcc compiler defines, with the -dM -E options. On Windows I was able to dump the output to a file with echo | arm-none-eabi-gcc -dM -E - > gcc-defines.txt
Second, add the defines to your c_cpp_properties.json file. Note that where the #define sets a value, you need to use an = sign here. (You could probably just add individual defines as you need them, but I used Excel to format them as needed and sort. The first defines are for my project, matching the defines in my Makefile.)
- Setting the Symbol Database
C++ Visual Studio For Mac
After doing a few experiments with individual defines, I could see the define as being processed in stdint-gcc.h, any uses of the types still produced errors. I realized in my c_cpp_properties.json file that I had 'databaseFilename': ' This is used for the 'generated symbol database', but was not configured properly. I set it to:
- Restart Visual Studio Code
After quitting and restarting Visual Studio Code, declarations do not result in the error, and when hovering over a variable, it shows the appropriate type.
mbmcavoymbmcavoy