compiler error

Megatree_de

Member
Hello,
I have a running application (cristmas tree) on my teensy 4.1 since years.
Now I have to make minor changes and tried to upload the existing code (without modifications).
I received so much errors from the compiler why I think it is a problem of new PC/installation/lib etc.
Can anyone take a look at the compiler errrors attatched to give me advice what I have to do.
(The version informations are also in the attached file)
View attachment Fehlermeldungen.txt

Thanks in advance
Andre
 
You get a linker error (not a compiler error), with "multiple definition".
Check, if you use the same code (with function definitions) again, maybe via different files or if you use code from a LIB and you have also the source code of the LIB in project.

Just figure out how often and where the functions are defined (you should find two references to the same).
Looks to me like a project setup issue or with linker arguments.

Viele Gruesse.
 
Hello,
before the forum server changed there were more messages to my request.
I would like thank everybody and tell the reason of the problem.
The artnet.h lib includes Ethernet.h and EthernetUdp.h this must change to NativeEthernet.h and NativeEthernetUdp.h
Thanks to all!
BR
Andre
 
@Megatree_de In my quest to achieve great compatibility, would you be willing to try QNEthernet? All you’d need is to replace NativeEthernet.h with QNEthernet.h (and add a “using” line: using namespace qindesign::network;) and you don’t need to include the UDP header. (And, of course, install the library.)
 
Last edited:
Hello shawn,
the last years I profited from the experience from the forum and guys.
May it be a possibility for me to contribute and helping.
Yes, I can test it but please note I´am not a programmer. Please tell me (in little steps) what I have to do.
I also can offer to send my code to you to modify.
Furthermore, I can give you access to my system. I think this would be the best solution because you can program, do perform tests and see the results.
It´s up to you.

BR
Andre
 
Thank you for the offer. If you're using the Arduino IDE, you can just add the "QNEthernet" library.

Next, do these steps:
1. Replace the NativeEthernet.h and NativeEthernetUdp.h includes with a single <QNEthernet.h> include.
2. Add a using namespace qindesign::network; line just below that.
3. That should be it.

If there's still some difficulty, sure, I don't mind the access offer.
 
Hi,
- installed QNEthernet via Arduino IDE
- NativeEthernet.h and NativeEthernetUdp.h has been marked as comment
- included <QNEthernet.h>
- added "using namespace qindesign::network;"
- (Artnet.h unchanged)
compiled, uploaded -> teensy Megatree is working
Attached you will find a lot of messages from compiler in the text file. My Video was too large to send..

Let me know if I should do something else.
 

Attachments

  • Fehlermeldungen_Forum_test.txt
    7.4 KB · Views: 122
Including the lines where Arduino IDE shows the LIBRARIES USED is important if Verbose is on those lines should be present.

All the lines are warnings ... Looking at:
C:\Users\Andre\Documents\Arduino\Teensy_Megatree_2023_V02_Forum_tes\Text.ino:16:1: warning: "/*" within comment [-Wcomment]
16 | /**************************************************************************************************************************************
|
C:\Users\Andre\Documents\Arduino\Teensy_Megatree_2023_V02_Forum_tes\Teensy_Megatree_2023_V02_Forum_tes.ino: In function 'void onDmxFrame(uint16_t, uint16_t, uint8_t, uint8_t*)':
C:\Users\Andre\Documents\Arduino\Teensy_Megatree_2023_V02_Forum_tes\Teensy_Megatree_2023_V02_Forum_tes.ino:160:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
160 | if (led < numLeds) // led Anzahl = 8 X 150 = 1200 -> led Bereich 0-1199
| ^
C:\Users\Andre\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\NativeEthernet_neu\src\NativeEthernetServer.cpp: In member function 'EthernetClient EthernetServer::available()':
C:\Users\Andre\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\NativeEthernet_neu\src\NativeEthernetServer.cpp:119:103: warning: enum constant in boolean context [-Wint-in-bool-context]
119 | if(socket_poll.events_occurred & (FNET_SOCKET_EVENT_OUT || FNET_SOCKET_EVENT_IN)) {
| ^~~~~~~~~~~~~~~~~~~~
C:\Users\Andre\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.1\libraries\FNET\src\service\llmnr\fnet_llmnr.c:60:30: warning: 'fnet_llmnr_ip6_multicast_addr' defined but not used [-Wunused-const-variable=]
60 | static const fnet_ip6_addr_t fnet_llmnr_ip6_multicast_addr = FNET_IP6_ADDR_INIT(0xFF, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x00, 0x03);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The first two would be found in the unshown INO file and easily corrected.
The Next suggest that NativeEthernetServer is still in use?
And that may account for all the following warning are about FNET?
 
Sorry, I think it is a missunderstanding of the functional princip.
The NativeEthernet.h and/or NativeEthernetUdp.h are still at my modified Artnet.h.
Should I work with the original?
At the moment I´m not at this system. Files can be send tomorrow. It´s late in ".de".
Wait for comments/instruction to test tomorrow.
 
Sorry, I think it is a missunderstanding of the functional princip.
The NativeEthernet.h and/or NativeEthernetUdp.h are still at my modified Artnet.h.
Should I work with the original?
At the moment I´m not at this system. Files can be send tomorrow. It´s late in ".de".
Wait for comments/instruction to test tomorrow.
Did you see step 1 of my post #7? To use QNEthernet, replace all NativeEthernet.h and NativeEthernetUdp.h includes with a <QNEthernet.h> include. Make sure to also do step 2 just below the step 1 change(s). I suppose I could have said “all” before, but I thought that was implied… :)

In any case, thank you for trying it out.

Yep, your .ino file would be helpful.
 
I changed the Artnet.h.
Now it looks better but we have still messages and the code won´t be uploaded.
 

Attachments

  • Fehlermeldungen_Forum_2.txt
    1 KB · Views: 101
  • Teensy_Megatree_2023_V02_Forum_tes.ino
    7 KB · Views: 577
I changed the Artnet.h.
Now it looks better but we have still messages and the code won´t be uploaded.
You didn’t attach your Artnet.h file, so I can't see what you have, but for that error, I suspect you didn’t do step 2, adding that “using” line. See my post #7.
To recap the steps:
1. Replace the NativeEthernet.h and NativeEthernetUdp.h includes with a single <QNEthernet.h> include.
2. Add a using namespace qindesign::network; line just below that.

For the .ino file, change lines 158-168 (becoming 158-169) to this (that will get rid of that "ambiguous else" warning):
Code:
      {
        int led = i - 150 + (universe - startUniverse) * (previousDataLength / 3); //- 150 für offset Steurdaten
        if (led < numLeds) { // led Anzahl = 8 X 150 = 1200 -> led Bereich 0-1199
            if (led < 1050){
            leds.setPixel(led, data[i * 3], data[i * 3 + 1], data[i * 3 + 2]); // Die leds 0 - 1049 haben RGB Ansteuerung
            }
            else
            {
            leds.setPixel(led, data[i * 3 + 1], data[i * 3], data[i * 3 + 2]); // Die leds 1050 - 1099 (8. Stripe) haben GRB Ansteuerung
            }
         }
      }

Note that there's an additional opening brace (line 160) and an additional close brace line (line 168).
 
Last edited:
Hi shawn,
the if/else was fixed already. Now I have add the line to the artnet.h.
Upload and function are OK.
 

Attachments

  • Artnet.zip
    1.4 KB · Views: 339
  • Fehlermeldungen_Forum_3.txt
    1 KB · Views: 316
  • Teensy_Megatree_2023_V02_Forum_tes.ino
    7 KB · Views: 105
The deprecated warning is fine. I'm just trying to encourage use of the other Ethernet.begin() functions that don't take a MAC address. I can't see the code because you didn't attach Artnet.cpp.

Sounds like it works now? :)
 
Artnet.cpp and picture
 

Attachments

  • Artnet.zip
    2.9 KB · Views: 317
  • WhatsApp Image 2023-11-14 at 19.36.38(1).jpeg
    WhatsApp Image 2023-11-14 at 19.36.38(1).jpeg
    232.6 KB · Views: 80
Your welcome! Anything else? :)
By the way. I think you realized I´m a beginner and doing copy codes. What is the benefit of your lib or the different to my used solution.
I tried to read the GitHub description but I do not understand.
BR
Andre
 
Your welcome! Anything else? :)
By the way. I think you realized I´m a beginner and doing copy codes. What is the benefit of your lib or the different to my used solution.
I tried to read the GitHub description but I do not understand.
BR
Andre
Everyone starts there too, no worries. I really appreciate that, even as a beginner, you were willing to try these steps out. It gives me information about how easy it is to use my Ethernet library (QNEthernet). I adjust from there.

A brief bit of history: The Teensy 4.1 design comes with an Ethernet PHY (short for "physical layer") chip for connecting to Ethernet. (Think RJ-45 plugs and network cables.) In order to use that hardware to connect to a network, usually something called a "driver" needs to be written that knows how to talk to the physical hardware (in this case, the PHY chip). That driver needs to be able to communicate with both the physical hardware via that chip, and to the rest of the system to funnel the data back and forth. It is often the case that someone writes a trial version of this to get a feel for how to do it. The first attempt at this was written, I think, by @manitou and is hosted by Mr. Stoffregen here: https://github.com/PaulStoffregen/teensy41_ethernet, under t41ether/lwip/src. (See lwip_t41.c and lwip_t41.h for the code; don't worry yet about trying to understand it.) It was designed to be the lowest layer of the "lwIP" (Lightweight TCP/IP) network stack. It provides a way to get data in and out of that PHY chip.

@vjmuzik came along and wrote a library that's included in the latest Teensyduino distribution, a library called "NativeEthernet". This was important because it's not the easiest thing in the world to use a driver directly. Instead, people usually interface with the low-level stuff with a well-known API. In the Arduino case, this is the Arduino Ethernet API. NativeEthernet is written to conform to this API and to the behaviour of older libraries that had certain quirks. The author likely used that original test driver code to write this more full-featured library. It's based on a network stack called "FNET". Think these layers in the library:
Arduino API -> Network stack (FNET) -> low-level driver code (similar to the above)

Fast forward to 2021, and I wanted a network library that had a different design under the hood. (Specifically, I use polling instead of a timer to check for incoming data. I needed this because the way NativeEthernet was doing the timers conflicted with how my DMX library (TeensyDMX) was itself using timers.) I also wanted to learn about how a networking stack and implementation work. That's my library, QNEthernet. Think these layers:
Arduino API (plus extras) -> Network stack (lwIP) -> low-level driver code (also similar (in intent) to the above driver, but with more stuff)

I can say that I use my own library in all my projects that need networking. I update it and frequently test it in real-world scenarios. It changes as I need changes (and as others file bug reports). QNEthernet is mostly "equivalent" to NativeEthernet in intent, but does things quite differently under the hood. They're similar in that they're both libraries designed to be mostly compatible with the Arduino Ethernet API, which is the important part for developers trying to use it. They both have a very similar common interface, so programs that want to switch should only need to make very minimal changes.

Note that a person that goes by JAndrassy on GitHub is doing some very interesting work on documenting and standardizing Arduino-adjacent Ethernet APIs. You can see their work here: https://github.com/JAndrassy/Arduino-Networking-API (see ArduinoNetAPILibs.md)

I hope this has been informative and useful.
 
Back
Top