Just wondering how I work out which of my C/C++ files is resulting in me getting an error.
The error is #error: error STL1003: Unexpected compiler, expected C++ compiler.
which comes from yvals_core.h
.
None of my source files directly include yvals_core.h
but do include headers that ultimately do include it. Is there anyway of determining the chain of includes that lead to the error so I can work out what I need to change in my source (FYI it's definately that I need to change something like cstdio to stdio.h, as I'm converting an old C project to modern libraries, I already updated the cstdio references, but trying to work out what the next thing to update is).
I'm working in Visual Studio 2022 on Windows 10, but can use other tools if it's more helpful.
In Project Settings > C/C++ > Advanced turn on Show Includes (see /showIncludes
), and recompile.
The compiler will list all includes in the Output window, in an ASCII tree (tabulated with spaces). This will take you closer to the culprit, although this is not as useful as clang's way.
/showIncludes
lists all includes regardless.