microsoft / microsoft/vscode-cpptools

IntelliSense errors with Parsing the .pb.h header file generated from the protobuffer proto file

Open
#14,116 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service parser verified Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: CentOS7
  • VS Code Version: 1.98.2
  • C/C++ Extension Version: 1.29.3
Bug Summary and Steps to Reproduce

Bug Summary:
Opening the .pb.h header file generated from the .proto file of Protobuf, there is IntelliSense error: this declaration has no storage class or type specifier.

  1. My protobuf version is 3.6.0
  2. The minimal case might look like this:
#include <google/protobuf/port_def.inc>
#include <google/protobuf/port_undef.inc>
#include <google/protobuf/port_def.inc>
PROTOBUF_NAMESPACE_OPEN
namespace internal {
class AnyMetadata;
}  // namespace internal
PROTOBUF_NAMESPACE_CLOSE
  1. Error displayed on macro PROTOBUF_NAMESPACE_OPEN

  2. The attachment here is the header file provided by protobuf
    protobuf-include.zip

Configuration and Logs
{
    "configurations": [
        {
            "name": "Linux",
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c11",
            "cppStandard": "c++11",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}
Other Extensions

No response

Additional context

No response

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 minimal .pb.h snippet and the diagnostic on PROTOBUF_NAMESPACE_OPEN, using the reported cStandard, cppStandard, and intelliSenseMode settings. Reproduce with protobuf-include.zip and the listed VS Code and C/C++ extension versions; done means the generated header no longer shows this IntelliSense error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.