• 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

VSCode / PlatformIO build errors after adding libraries

Q&A Forum › Category: ESP32 › VSCode / PlatformIO build errors after adding libraries
0 Vote Up Vote Down
Graham Sherwood asked 2 years ago

Hi
I am working through your Build_Web_Servers_ESP32_ESP8266 ebook.
I have installed the software, and with an ESP32 connected got the flashing LED example working ok.
But after adding the library for the BME280 sensor I get this build error ( no code changes to the blinking LED example ) :

compilation terminated.
Compiling .pio\build\fm-devkit\FrameworkArduino\Print.cpp.o
*** [.pio\build\fm-devkit\libcf6\Adafruit BME280 Library\Adafruit_BME280.cpp.o] Error 1

Removing the line – lib_deps = Adafruit BME280 Library @ 2.1.2 – from platformio.ini which got added when I added the library returns a build success.
If I go to PIO Home / Libraries / Installed I cann see the BME280 library entry.

Any suggestions welcome !

I dont understand why adding a library, withoutchanging any code , should cause a build failure?
 

4 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi. 
Are you following the blinking LED project?
You don’t need to include those libraries on the platformio.ini file. Otherwise you’ll get an error because those libraries are not being used.
Delete any library that you have added to the platformio.ini file and the code should compile. Just include libraries that are used in your code.
Regards,
Sara

0 Vote Up Vote Down
Graham Sherwood answered 2 years ago

Hi
Yes I have completed the blinking LED project , and am moving onto the next project.
The next step in the book is to install the BME208 library , linking it during install to the blinking LED project.
Having done this the blinking LED project stops building – is this correct ?
At this time no code is accessing the library , that gets added in subsequent steps.
Are you saying it wont build until code is added to the project which accesses the library just added ?
Thanks

0 Vote Up Vote Down
Steve Mercer answered 2 years ago

You are telling PIO that your code depends on this library when it doesn’t. Just add the line:

BME280 bme;
And you should be good to go.
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
After the blinking LED project, we’re just showing how to add libraries if necessary, and we give an example on how to do it.
You’re not supposed to run the blinking LED project with the BME280 library. Just add the library when you use it in your code.
I hope this is clear.
Let me know if you have more doubts.
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

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

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

Copyright © 2013-2023 · 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.