khoih-prog / EthernetWebServer

This is simple yet complete WebServer library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and `ESP8266 ESP8266WebServer` libraries. Ethernet_Generic library is used as default for W5x00 with custom SPI
MIT License
178 stars 49 forks source link

undefined reference to EthernetWebServer #78

Closed psykokwak-com closed 1 year ago

psykokwak-com commented 1 year ago

Describe the bug

In multiple files project I have undefined references.

Steps to Reproduce

Use the multifile project example with "#define USE_NATIVE_ETHERNET true" (because teensy 4.1)

Expected behavior

Build successful

Actual behavior

Build error

MyFile.cpp.o: In function __static_initialization_and_destruction_0 MyFile.cpp:6: undefined reference to EthernetWebServer EthernetWebServer(int) MyFile.cpp:6: undefined reference to EthernetWebServer ~EthernetWebServer()

Please ensure to specify the following:

Please be educated, civilized and constructive. Disrespective posts against GitHub Code of Conduct will be ignored and deleted.

khoih-prog commented 1 year ago

Hi @psykokwak-com

Can you try moving the

#define USE_NATIVE_ETHERNET true

to multiFileProject.ino

I'm testing compile OK here

Selection_248

Beware that the multiFileProject is just the very bare and minimal example for it's simplest demo purpose, and don't use it for complex use-case, unless you're sure what you're doing.

As you also didn't post the full code or at least the MRE, I suggest you

  1. follow the example code, then modify until it breaks and know what the issue is.
  2. change to use the better and supportive QNEthernet, instead of the NativeEthernet

Anyway, I'm closing this issue now and won't reopen until you convincingly prove there is a real bug of the library.

Good Luck,