Libraries are NOT fool proof, actually a huge time sink

I just went through the futile exercise of putting this working library into every folder on my PC. Why isn’t it being recognized?

I’m really boring myself with the constant complaints about PlatformIO and libraries.

Untitled

And as you see, the Fonts folder was added, but ‘#include “font8x8_basic.h”’ is still squiggled.

I need the plain how-to, but I already have it. There’s nothing else I can do.

Can somebody just tell me how to do this correctly? Point me to a resource besides whatever I’ve been able to access here?

That automated library finder stinks. Hardly any of the libraries I’ve looked for are in it, but I can get them and save them locally and then you don’t face the fact that I have them. This is an example from Espressif. I do not believe it doesn’t work.

I mean, I’m an automation engineer. I took BASIC in 1979, and I’ve been buried in computers my whole life and i CAN"T GET THE APPLICATION TO SEE THE DOCUMENT IN THE FOLDER? A stinking text file???

There are actual things that are actually over my head, and that’s what I’m supposed to be learning. This is under my head, and I’m sick of it. So please excuse the frustrated typing. It’s very loud.

1 Like

Can you post your platformio.ini file?

1 Like

Please additionally provide a description of what you are trying to achieve with your project. From your screenshot, it looks as if you have setup a ESP-IDF project and are trying to use Arduino libraries. So please describe if the use of a particular framework is important and if so which one.

Here are some tips:

  • If you want to reuse existing libraries, use the Arduino framework. There are few libraries compatible with other frameworks (e.g. 4,559 Arduino libraries vs. 80 ESP-IDF libraries)
  • Use lib_deps for managing libraries and let PlatformIO manage them automatically.
  • Don’t use ~/.platformio/lib. Empty the directory.
  • If ~/.platformio/lib must still be used, never put anything there manually. Instead, use PlatformIO’s UI to install a library globally. Manually installed libraries won’t work.
1 Like

Thanks everybody.

I will empty the directory and add missing libraries to the lib folder in Projects.

I just successfully added a library using the PIO utility this afternoon. I had to restart to get it recognized, but it unsquiggled.
And Arduino.h unsquiggled for the first time in the month I’ve been at this.

Really need a good resource for translating Arduino into C++, unlearning the short cut stuff.

1 Like

Not the first time I’ve seen this.

Can someone explain it?

CurieForSomeReason

Why is it looking for a library that isn’t a library that isn’t called for???

That’s the whole program, and I copied it correctly from a textbook.

Can you please add:

  • platformio.ini file
  • Entire build output (as there is a lot of diagnostic information at the top of the output)

One possible solution:

  • Delete the directory .pio in your project folder
  • Try to build again

PlatformIO has a long-standing bug that it does not properly clean up libraries in .pio. So in the process of experimenting with your program, you might have collected libraries that are no longer needed or even causing problems.

The bug is supposed to be fixed with a major update of library management, which is obviously taking longer than expected.

1 Like

I spent a lot of time trying to jam CurieBLE into it. I guess it left a trail.

I just got the threads of my learning curve teased apart. I have to learn C++, which is going pretty well, and I have to learn this new IDE, which seems like it’s going well. There is a list of things that have been cleared up by my own guesswork, but the tidbits I’ve gotten from this community have been multipliable.

In this case, I wrote a C++ program from the text I’m using, but it wasn’t associated with a board or a project. It was still a text file with no folder. Now I’ve created a project and associated it with an Uno, and here we go with the libraries again:

> Executing task in folder C_WORK: C:\Users\joema\.platformio\penv\Scripts\platformio.exe run <

Processing uno (platform: atmelavr; board: uno; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.2.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\uno\src\main.cpp.o
Archiving .pio\build\uno\libFrameworkArduinoVariant.a
Compiling .pio\build\uno\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o
src\main.cpp:1:20: fatal error: iostream: No such file or directory
compilation terminated.
*** [.pio\build\uno\src\main.cpp.o] Error 1
================================================== [FAILED] Took 2.30 seconds ==================================================
The terminal process "C:\Users\joema\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

PIO doesn’t have iostream?
It’s messing with me now.

ini:

; 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:uno]
platform = atmelavr
board = uno
framework = arduino

library remnant again

The problem is related to main.cpp but you are showing the code of main1.cpp.

This is a new file. Main1.cpp is Main.cpp with nothing but the definitiions. These new errors come from Main1.cpp.

Sorry, but in order to help you, we need a source file and and error message that match. Compilers produce precise error messages, in particular with file name, line number and character position.

In your case, the error message says:

src\main.cpp:3:19: fatal error: Servo.h: no such file or directory

So it refers to line 3 and most likely to an statement like #include "Servo.h". But in the source code you are showing, line 3 is a comment and there is no trace of Servo.h.

In order to help. we often try to reproduce the problem. That’s easy to do if the source code is posted as text, but almost impossible if a screenshot is posted. So real source code is strongly preferred over screen shots.

1 Like

I deleted the inclusion when I deleted the servo stuff from the code. The error message is apparently based on the ghost in the pio folder you told me about. I deleted the lines and saved it as main1. Main was no longer open.

I’ve done it a few more times- deleted the pio folder. There were apparent artifacts in the error messages, as you see here. The good news is that it seems to work. It’s just tedious.

My list is too big to re-run main1 without the pio folder right now, but I’ll let you know what happens later.

Main1 still raises the same errors. I tried to get verbose, but it didn’t work.
This entire program is a set of proper definitions. There’s one setup and one loop.

How am I getting these responses from the compiler? What did I do?

MOD EDIT: Please use code formatting in future! ``` before and after the code block

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR 2.2.0 > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Servo> 1.1.6
Building in release mode
Compiling .pio\build\uno\src\main.cpp.o
Compiling .pio\build\uno\src\main1.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\avr\Servo.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\mbed\Servo.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\megaavr\Servo.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\nrf52\Servo.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\sam\Servo.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\samd\Servo.cpp.o
Compiling .pio\build\uno\lib2e3\Servo\stm32f4\Servo.cpp.o
Archiving .pio\build\uno\libFrameworkArduinoVariant.a
Compiling .pio\build\uno\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o
Archiving .pio\build\uno\lib2e3\libServo.a
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\uno\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Print.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\uno\FrameworkArduino\USBCore.cpp.o
Compiling .pio\build\uno\FrameworkArduino\WInterrupts.c.o
Compiling .pio\build\uno\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\uno\FrameworkArduino\WString.cpp.o
Compiling .pio\build\uno\FrameworkArduino\abi.cpp.o
Compiling .pio\build\uno\FrameworkArduino\hooks.c.o
Compiling .pio\build\uno\FrameworkArduino\main.cpp.o
Compiling .pio\build\uno\FrameworkArduino\new.cpp.o
Compiling .pio\build\uno\FrameworkArduino\wiring.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_analog.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\uno\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\uno\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\uno\libFrameworkArduino.a
Linking .pio\build\uno\firmware.elf
.pio\build\uno\src\main1.cpp.o (symbol from plugin): In function `setup':
(.text+0x0): multiple definition of `setup'
.pio\build\uno\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
.pio\build\uno\src\main1.cpp.o (symbol from plugin): In function `setup':
(.text+0x0): multiple definition of `loop'
.pio\build\uno\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
.pio\build\uno\src\main1.cpp.o (symbol from plugin): In function `setup':
(.text+0x0): multiple definition of `ldrbotr'
.pio\build\uno\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
.pio\build\uno\src\main1.cpp.o (symbol from plugin): In function `setup':
(.text+0x0): multiple definition of `ldrbotl'
.pio\build\uno\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
.pio\build\uno\src\main1.cpp.o (symbol from plugin): In function `setup':
(.text+0x0): multiple definition of `ldrtopr'
.pio\build\uno\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
.pio\build\uno\src\main1.cpp.o (symbol from plugin): In function `setup':
(.text+0x0): multiple definition of `ldrtopl'
.pio\build\uno\src\main.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1
======================================================================================== [FAILED]

There still seems to exist src/main1.cpp and src/main.cpp causing the error, or its build artifact (the object file) wasn’t properly cleaned up. Try cleaning the project via the “Clean” project task

1 Like

I created a new project, so we’re working with Main again. Same file, same code.

It compiles. Parts of it already work. I’m trying to figure out why the servo isn’t servoing, so I ran Test.

This is something that drives me crazy: undefined reference to loop, setup. I see ‘multiple definitions’ and ‘undefined’, and I never understand how I raise that error.

Solar-1-errors

I inserted a main function, to see if that would change anything, and I deleted the pio folder. Didn’t.

How am I raising this error? Is it the same error???

//Sun Tracker Sketch
//
//This sketch is designed for use with a 9gram servo, able
//to be powered directly from the Arduinio without an external
//power source. For fritzing diagram, see Github repository
//https://github.com/nickalanf/Arduino–Projects
//The Serial monitor section is for debugging purposes, or for general interest,
//one once the device is functioning correctly, can be diasabled
//
//Sketch by FIELDING - 8/2/18
#include <Arduino.h>
#include <Servo.h>
Servo servo; // Create a servo object to control the servo
int eLDRPin = A0; // Assign pins to the LDR’s
int wLDRPin = A1;
int eastLDR = 0; //Create variables to store to LDR readings
int westLDR = 0;
int difference = 0; //Create a variable to compare the two LDR’s
int error = 10; // Variable for is there is a noticable difference between the two LDR’s
int servoSet = 130; //Variable for position of servo - will be different for each device

int main() {}

void setup() {
servo.attach(9); //attaches the servo object to PWM pin 9
Serial.begin(9600);
}

void loop() {
eastLDR = analogRead(eLDRPin); //Read the LDR values
westLDR = analogRead(wLDRPin);
if (eastLDR < 400 && westLDR < 400) { //Check to see if there is low light on both LDR’s
while (servoSet <=140 && servoSet>=15){ // if so, send panels back to east for the sunrise
servoSet ++;
servo.write(servoSet);
delay(100);
}
}
difference = eastLDR - westLDR ; //Check the difference
if (difference > 10) { //Send the panel towards the LDR with a higher reading
if (servoSet <= 140) {
servoSet ++;
servo.write(servoSet);
}
} else if (difference < -10) {
if (servoSet >= 15) {
servoSet --;
servo.write(servoSet);
}
}
Serial.print(eastLDR); //Serial monitor can be useful for debugging/setting up
Serial.print(" - “); //Use it to see if your LDR’s are noticeably different when
Serial.print(westLDR); //They have equal light shining on them, if so, correct with the error value
Serial.print(” - “);
Serial.print(difference);
Serial.print(” - “);
Serial.print(servoSet); //Fine tune the servo settings, to maximise swing available
Serial.print(” - “);
Serial.println(”.");
delay(1000);
}

This is a different version of the original Main. The first was a solar tracker with two motors. This one only uses one motor.

The sensors are giving good differences, but the servo isn’t actuating, beyond the initial plug-in.