Which .h files are included implicitly during compilation with cl.exe ?

Basil Anna 1 Reputation point
2022-12-06T08:56:25.97+00:00

Why this compiles, when I don't include any .h file with size_t definition ?

int main () {  
  size_t volatile a{ 1 };  
  return 0;  
}  

The compilation command is simply "cl.exe filename.cpp" without any parameters.

Developer technologies | C++
Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 49,636 Reputation points
    2022-12-06T12:44:24.493+00:00

    Take a look at the following SO link -- https://stackoverflow.com/questions/48234476/c-size-t-doesnt-need-cstddef-header

    I think what you are seeing is behavior exhibited by the VC++ compiler, not the implicit inclusion of header files. If I open a standard command prompt window and run cl.exe without setting any of the usual environment variables set by a Developer Command Prompt (include file, library paths, etc.) your code will still compile although it will not link.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.