Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split .h and .cpp #7

Open
matteogaria opened this issue Jul 17, 2020 · 0 comments
Open

Split .h and .cpp #7

matteogaria opened this issue Jul 17, 2020 · 0 comments

Comments

@matteogaria
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant