Skip to content

identifier "size_t" is undefined, with clang 18 #12618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Colengms opened this issue Aug 23, 2024 · 4 comments
Closed

identifier "size_t" is undefined, with clang 18 #12618

Colengms opened this issue Aug 23, 2024 · 4 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service Visual Studio Inherited from Visual Studio
Milestone

Comments

@Colengms
Copy link
Contributor

With clang 18(.1.3), I'm seeing an issue with size_t, which doesn't repro with earlier versions of clang. (15-17).

The issue likely has something to do with how the clang-18 headers decide whether or not to define size_t. Some IntelliSense predefines may be confusing it, making it think size_t is already defined.

image

@sfan5
Copy link

sfan5 commented Aug 29, 2024

Can confirm this with Clang 18.1.8 and vscode-cpptools 1.22.0 on Linux x64.
I have the settings automatically detected from compile_commands.json, which always used to work fine.

@bobbrow bobbrow moved this to Todo in cpptools Aug 29, 2024
@bobbrow bobbrow added this to the On Deck milestone Aug 29, 2024
@browntarik
Copy link
Contributor

browntarik commented Sep 16, 2024

I have filed a bug with the internal VS (2253203) Team. As this is most likely the cause of #12319, that bug will be put on the back burner until this has been resolved.

@browntarik browntarik added the Visual Studio Inherited from Visual Studio label Sep 16, 2024
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, Tracking Sep 16, 2024
@sean-mcmanus sean-mcmanus moved this from Todo to Triage in cpptools Sep 16, 2024
@bobbrow
Copy link
Member

bobbrow commented Sep 18, 2024

A workaround is to add this to your defines in c_cpp_properties.json:

    "defines": [
        "__building_module(x)=0"
    ]

I don't know that we have an easy way to inject that in the compile_commands.json case, but someone else on the team may have an idea.

@Colengms Colengms added the fixed Check the Milestone for the release in which the fix is or will be available. label Sep 19, 2024
@sean-mcmanus sean-mcmanus modified the milestones: Tracking, 1.22.4 Sep 20, 2024
@sean-mcmanus
Copy link
Contributor

@sfan5 Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.22.4 .

@github-project-automation github-project-automation bot moved this from Triage to Done in cpptools Sep 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service Visual Studio Inherited from Visual Studio
Projects
Status: Done
Development

No branches or pull requests

5 participants