ILI9341_t3 swap() conflict

Status
Not open for further replies.

Bob Larkin

Well-known member
A swap(a,b) function is defined for ILI9341_t3.h and .cpp. This is wrapped by a #ifndef, and if encountered after another swap() declaration, should fall back to the previous. This seems to work fine under Windows and Linux, as long as the ILI9341_t3.h include is second. The Vector Network Analyzer project
https://forum.pjrc.com/threads/41326-Update-Audio-Vector-Network-Analyzer
has a builder that cannot get the AVNA program RSL_VNA5.ino to compile under Mac OS-X. The errors say, I think, that std::vector library is encountering errors using the ILI9341_t3.h definition of swap().

The std:vector is seen first, per the snippet
Code:
#include <vector>
 // swap() collision between ILI9341_t3 and vector.  A problem?  Order as shown stops
#include <ILI9341_t3.h>
but that does not seem to keep the order on the Mac.

I changed the name swap to swap_t3 in the ILI9341_t3 files., and I think that fixes it. But, I assume it is undesirable to have different swap() definitions that are protected by the order they are encountered. My question: what is the correct way to solve the problem for everybody? (I can work with a private ILI9341 library, but that doesn't help others).
 
Status
Not open for further replies.
Back
Top