platformio / platformio/platformio-core

Visual Studio IntelliSense does not recognize basic using std::xyz statements

Open
#4,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted integration
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system: Windows 10 x64

PlatformIO Version (platformio --version):

Description of problem

When telling PlatformIO to generate project files for Visual Studio and one opens the project file in Visual Studio, it fails to recognize basic C++ namespaces. To my knowledge this is not the same issue as observed in https://github.com/platformio/platformio-core/issues/662#issuecomment-220092057 and https://docs.platformio.org/en/latest//integration/ide/visualstudio.html#intellisense-errors because

IntelliSense does not understand GCC-specific definitions.

Does not apply to the code

using std::min;
using std::max;
using std::round;
using std::isinf;
using std::isnan;

that is causing IntelliSense errors.

grafik

Error message reads: "Namespace std has no member isnan".

So it seems to me that the Visual Studio project template is not correct and misses some setting (e.g., C++ version).

Steps to Reproduce
  1. Download project https://github.com/maxgerhardt/pio-visualstudio-cpp17
  2. Re-initialize VisualStudio project files with pio init --ide=visualstudio
  3. Open generated solution file in Visual Studio
  4. Follow Arduino.h (Ctrl+Click)
  5. Observe errrors
Actual Results

Visual Studio does not recognize C++ (17) standard namespaces within

Expected Results

Intellisense regarding basic C++ features works.

If problems with PlatformIO Build System:

Refer example project.

Additional info

Compilation of the project which uses C++17 features works as normal with pio run.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the example project at https://github.com/maxgerhardt/pio-visualstudio-cpp17 and regenerate its solution using pio init --ide=visualstudio. Follow Arduino.h in Visual Studio and compare the generated project settings with the C++17 code using std::min, std::max, std::round, std::isinf, and std::isnan; done means IntelliSense recognizes these namespaces while pio run continues to compile.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.