2025-02-21 6:31 AM - last edited on 2025-02-25 12:59 AM by Andrew Neil
Hello,
I have a question that is completely unrelated to STM, but I believe you can help me.
I would like to advise why I cannot use the following code and the message multiple definition comes out.
I will reduce the code to the necessary minimum.
I thought local variables in files only have local effect, can someone explain this to me?
Thank you
main:
#include "A.h"
#include "B.h"
void main()
{}
A.h:
---------
A.c:
#include "A.h"
int i;
----------
B.h:
----------
B.c:
#include "B.h"
int i;
Solved! Go to Solution.
2025-02-21 6:55 AM
Hello,
Declare int i as static:
static int i;
2025-02-21 6:52 AM
Hi,
https://letmegooglethat.com/?q=avoid+multiple+definition+header+file+c
read:
2025-02-21 6:55 AM
Hello,
Declare int i as static:
static int i;