You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
using include guards is not useful if declaration and definition are in the same source file.
In a complex project, where the .h is included by several source file, you get a linker error like this:
libraries\core\device.cpp.o (symbol from plugin): In function Crc16::reflect(unsigned char)':
(.text+0x0): multiple definition of Crc16::reflect(unsigned char)' sketch\dualRelay.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\core\device.cpp.o (symbol from plugin): In function Crc16::reflect(unsigned char)':
(.text+0x0): multiple definition of Crc16::reflect(unsigned int)' sketch\dualRelay.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\core\listener.cpp.o (symbol from plugin): In function Crc16::reflect(unsigned char)':`
solution is to split header and implementation file (.h & .cpp)
Best Regards and thanks for your work
The text was updated successfully, but these errors were encountered:
Hi,
using include guards is not useful if declaration and definition are in the same source file.
In a complex project, where the .h is included by several source file, you get a linker error like this:
libraries\core\device.cpp.o (symbol from plugin): In function
Crc16::reflect(unsigned char)':(.text+0x0): multiple definition of
Crc16::reflect(unsigned char)' sketch\dualRelay.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\core\device.cpp.o (symbol from plugin): In function
Crc16::reflect(unsigned char)':(.text+0x0): multiple definition of
Crc16::reflect(unsigned int)' sketch\dualRelay.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here libraries\core\listener.cpp.o (symbol from plugin): In function
Crc16::reflect(unsigned char)':`solution is to split header and implementation file (.h & .cpp)
Best Regards and thanks for your work
The text was updated successfully, but these errors were encountered: