Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Getting error after using extern #4

Answered by khoih-prog
otl1 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @otl1

Thanks for your encouraging words.

The real reason is that I'm using the better h-only style for many of my libraries. To avoid Multiple Definitions Linker Error, we have to follow instructions in HOWTO Fix Multiple Definitions Linker Error and the example multiFileProject

  • The *.h file must be included only once, for example in main.cpp or main .ino files
  • The *.hpp file can be included as many times as necessary, without Multiple Definitions Linker Error

I'm sorry that I haven't included the similar section in this library.


From the above explanation, you can see in your original code, the AsyncMQTT_ESP32.h has been included in

  • defines.h and
  • Test.h via defines.h

To fix your …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@otl1
Comment options

Answer selected by otl1
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants