Python module solution & project got created without error but code hinting says it can’t find python.h.
Source file created by default is C, but this tutorial from M$ says to use CPP. IIRC both are valid for the compiler but does this mean that the default project is “wrong” in some way(since the blog is from like a week ago)?
Surely if I’m just trying to test compilation it’s simplest to copy and paste from that blog, but how can I do that if the default project is generated in C rather than CPP?
And, yes, I just updated vs2022.
Thanks so much
Both of these seems to be issues with Visual Studio, rather than with the Python language or the CPython distribution (the subject of this Discourse), and thus you’re likely to get much better help asking on a Visual Studio-related forum, subreddit, Discourse, etc.
If compiling and running the code works just fine, this seems like an issue with the Visual Studio linter. I suggest following the troubleshooting steps in the document you linked which mention this issue, albeit in the compilation phase. If that doesn’t fix it, Google or another Visual Studio specific forum might be able to help, unless someone here happens to be familiar with it.
You can write extension modules in either C or C++. Neither are wrong; you created a C project, but the MS tutorial is for C++. Especially if you’re starting out, for C++ it’s usually a much easier and more robust choice to use PyBind11 than using the lower-level, C-native CPython API, whereas if you’re targeting C, Cython is usually a better choice.
It seems you can either generate a C++ project following the steps in that article, or adapt the code there to pure C.