0

Visual Code is not recognizing "windows.h" even though the Windows SDK has already been installed in my computer. Maybe I am not integrating it correctly to Visual Code?

enter image description here

Note: I am using espressif's extension for VS Code. The purpose is to program an ESP32 with an external sensor. The external sensor has an API and the issue is occurring when I am trying to call this specific API.

  • What does this have to do with ESP32? – romkey Apr 15 '21 at 17:27
  • I am using espressif's extension for VS Code. Maybe I should clarify that in the post. – Carlos Orozco Apr 15 '21 at 17:29
  • If it can't find the header then you haven't configured the include directories correctly: https://stackoverflow.com/a/58839719/2193968 – Jerry Jeremiah Apr 15 '21 at 22:14
  • Are you expecting that you can use the Windows SDK to write programs for the ESP32 or this "Windows SDK" and "Windows.h" file something that are specifically made for the ESP32? – romkey Apr 16 '21 at 03:04
  • For the ESP32 I am using espressif extension for VS Code. I am using one of their I2C examples scripts. I am trying to implement an external sensor to the I2C communication but this sensor has it's own API to manage all the data/registers. The API of the sensor is the one that requires "windows.h". I am assuming this is related to Windows SDK base on the research I have done, but I am not 100% sure if my issue is related to Windows SDK or not. – Carlos Orozco Apr 16 '21 at 03:35
  • 2
    You need to use sensor code that's designed to run on the ESP32. If it uses "Windows.h" then it's Windows code and it's not built for the ESP332 environment. You're not finding "Windows.h" because the Windows SDK has nothing to do with the ESP32. – romkey Apr 16 '21 at 03:48
  • I mean, it works when I run the ESP32 using the Arduino IDE and importing the required library to work with the sensor but I don't want that. If it works in the Arduino IDE why shouldn't it work on Visual Code? – Carlos Orozco Apr 16 '21 at 04:04
  • I'm really doubting that you have code building under the Arduino IDE that uses "Windows.h" – romkey Apr 16 '21 at 04:11
  • Well... it builds and it does I2C on Arduino. The difference is that the sensor's API is already an Arduino Library and I was able to implement it very easily. – Carlos Orozco Apr 16 '21 at 04:17
  • So it's a totally different library; it's not the code you're trying to build under VSCode. Whatever the code is that you're trying to build under VSCode is clearly not intended for the ESP32. Which is why it can't find "Windows.h". – romkey Apr 16 '21 at 04:25
  • Carlos, you're doing something very wrong. romkey is correct, including Windows.h in any ESP32 programs makes no sense whatsoever. – Tarmo Apr 16 '21 at 06:52

0 Answers0