• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Using Vs code instead of Arduino IDE

Q&A Forum › Using Vs code instead of Arduino IDE
0 Vote Up Vote Down
mal_rixon asked 3 years ago

Working through smart home with raspberry pi esp32 and esp8266 and I wouldprefer to use VS Code but when I try to import AsyncMQTT library and AsyncTCP via platfoemio / libraries I find AsyncMQTT_Generic by Marvin ROGER which i think is the correct one I still get an error on the include statment within main.cpp saying I need to edit my library path file.
Now I realize this is all out of the range of your book I would like to take this oportunuty to also learn VS code so if you could point me in the direction of a good tutorial that would be great.  I have looked at the one that Rui did but unfortuneately it dows not cover libraries.
Cheers Mal

7 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
How are you installing the library? Are you using the button Add to Project? After that, compile the code and then upload it.
We have this getting started guide for VS Code.

Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)

0 Vote Up Vote Down
mal_rixon answered 3 years ago

I am using the wifiscan program by Rui
I am installing libraries as per the above tutorial.  Yes adding to the project. Before I compile I get an error indicated on the line

#include <AsyncMqttClient.h> {Just found this had to change this  line to #include <AsyncMqtt_Generic.h>}

Which fixed my inital problemvbut it still wont compile see below for the errors.

This is my platform.ini file

PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200
lib_deps =
me-no-dev/AsyncTCP@^1.1.1
khoih-prog/AsyncMQTT_Generic@^1.7.0

Now when I compile it I get a bunch of errors

Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\Dhcp.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\Dns.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\EthernetClient.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\EthernetServer.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\EthernetUdp.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\STM32Ethernet.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\utility\ethernetif.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\utility\stm32_eth.cpp.o
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/ethernetif.cpp:48:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
*******************************************************************
#include “stm32_def.h”
^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\utility\ethernetif.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetUdp.h:43,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/Dhcp.h:7,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/Dhcp.cpp:6:
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/stm32_eth.h:42:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
*******************************************************************
#include “stm32_def.h”
^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\Dhcp.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetUdp.h:43,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/Dns.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/stm32_eth.h:42:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
*******************************************************************
#include “stm32_def.h”
^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\Dns.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetClient.h:7,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/STM32Ethernet.h:6,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetServer.cpp:5:
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/stm32_eth.h:42:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
*******************************************************************
#include “stm32_def.h”
^~~~~~~~~~~~~
compilation terminated.
In file included from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetClient.h:7,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/STM32Ethernet.h:6,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/STM32Ethernet.cpp:1:
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/stm32_eth.h:42:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
*******************************************************************
#include “stm32_def.h”
^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\EthernetServer.cpp.o] Error 1
*** [.pio\build\esp32doit-devkit-v1\lib287\STM32Ethernet\STM32Ethernet.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetClient.h:7,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/STM32Ethernet.h:6,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetClient.cpp:7:
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/stm32_eth.h:42:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
*******************************************************************
#include “stm32_def.h”
^~~~~~~~~~~~~
compilation terminated.
In file included from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetClient.h:7,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/STM32Ethernet.h:6,
from .pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/EthernetUdp.cpp:28:
.pio/libdeps/esp32doit-devkit-v1/STM32Ethernet/src/utility/stm32_eth.h:42:10: fatal error: stm32_def.h: No such file or directory
*******************************************************************
* Looking for stm32_def.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:stm32_def.h”
* Web > https://registry.platformio.org/search?q=header:stm32_def.h
*
I am running arduino.ide 1.8.19
just updated from 1.8.13
Hope all this helps
Thanks in advane
Mal

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Accordingly to the error, you need to install the stm32_def.h library.
Regards,
Sara

0 Vote Up Vote Down
mal_rixon answered 3 years ago

Could not find anything relating to stm32_def.h library but found other peple were also having trouble with it using the AsyncMQTT_Generic library/ Found I needed to use the AsyncMqttClientlibrary and not the AsyncMQTT_Generic  as your book says. 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Is everything working as expected now?
Regards,
Sara

0 Vote Up Vote Down
mal_rixon answered 3 years ago

yes thank you

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Great!
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.