Just trying this module out and getting build errors with one of the examples, any ideas?
Compiling .pio\build\teensy41\src\main.cpp.o
Compiling .pio\build\teensy41\lib483\QNEthernet\QNEthernet.cpp.o
In file included from src\main.cpp:18:0:
include/defines.h:374:8: warning: #warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error [-Wcpp] #warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
^
In file included from include/defines.h:422:0,
from src\main.cpp:18:
.pio\libdeps\teensy41\EthernetWebServer_SSL\src/EthernetWebServer_SSL.h:125:4: warning: #warning SENDCONTENT_P_BUFFER_SZ using default 4 Kbytes [-Wcpp] #warning SENDCONTENT_P_BUFFER_SZ using default 4 Kbytes
^
.pio\libdeps\teensy41\QNEthernet\src\QNEthernet.cpp:12:21: fatal error: Entropy.h: No such file or directory
The Entropy library is included in the Teensy core. You shouldn’t need to include it in your code anywhere. It will be picked up automatically. (Remove anything you’ve manually added.)
You may need to set some QNETHERNET_SOMETHING macro in order to correctly build the web server code with QNEthernet.
If you still can’t get this to work, could you paste minimal source code that reproduces the build problem? If I have some time, I’ll create a new project with the above platform.ini contents to see if I can reproduce and solve it on my end.
when I start adding other lib_deps and/or #include(s)
My solution is adding
#include “Entropy.h”
as first include to
main.cpp
This also works with libraries that depend on “ssilverman/QNEthernet”. (like “khoih-prog/WebSockets2_Generic”; after “cleaning up” the “WebSockets2_Generic/library.json” file :))
Build. (main.cpp is effectively empty; its contents are just the initial default.) I see the missing Entropy.h error.
Add #include <QNEthernet.h> to main.cpp.
Rebuild. I don’t see the error. My main.cpp looks like this:
#include <Arduino.h>
#include <QNEthernet.h> // <-- Added this
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
It sounds like there might be some more dependency issues if the library path is modified? What happens when you add the above include to your program (if it isn’t already)? I’m having some trouble reproducing the error. The Entropy library is included in the Teensyduino framework here: ~/.platformio/packages/framework-arduinoteensy/libraries/Entropy.
I’d like to figure this out so I can add it to the README if others encounter this. @mtjs@david2: What further steps do I need to take so I can see the problem after step 4?
In platformio.ini, set library_ldf_mode = deep (or deep+).
By default, PlatformIO only looks one level deep for dependencies, and the Entropy library is a dependency of QNEthernet. Since QNEthernet is itself a dependency of one of the project’s library dependencies, the system won’t find the Entropy library without one of the above two steps.
A follow up: I put in my own entropy routines and no longer depend on the Entropy library. (Note: the behaviour can be changed back to using Entropy by defining a macro.)