Closed wmarchewka closed 2 years ago
Cross-posted to https://community.platformio.org/t/multiple-include/28287
Hi @wmarchewka
This library is current using h-only style, and to use it correctly, you have either use the h-only style for your code or to include the library h
files a little bit more carefully.
For example
#include "UdpListener.h"
UdpListener udp_server;
void setup()
{
delay(1);
}
void loop()
{
delay(1);
}
#pragma once
#ifndef UDPLISTENER_H
#define UDPLISTENER_H
#include <AsyncUDP_WT32_ETH01.h>
class UdpListener
{
private :
public:
UdpListener();
};
#include "UdpListener_Impl.h"
#endif
#pragma once
#ifndef UDPLISTENER_IMPL_H
#define UDPLISTENER_IMPL_H
UdpListener::UdpListener()
{
}
#endif
Also have a look at Fixed linker errors when included in multiple .cpp files #1
Anyway, I'll convert this outdated library later to use the same style as AsyncUDP_Teensy41 library, then you can use the example similar to multiFileProject
Thanks to @maxgerhardt for the providing the solution in https://community.platformio.org/t/multiple-include/28287
Thanks all !
Hi @wmarchewka
Check the new AsyncUDP_WT32_ETH01 release v2.1.0 and the multiFileProject
multiple-definitions
linker error
Using platformio on a mac, trying to get this very simple code to compile. I get issues with the linker.
main.cpp
UdpListener.h
UdpListener.cpp
Verbose mode can be enabled via
-v, --verbose
option