2025-02-21 06:31 AM - edited 2025-02-21 06:41 AM
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 06:55 AM
Hello,
Declare int i as static:
static int i;
2025-02-21 06:52 AM
Hi,
https://letmegooglethat.com/?q=avoid+multiple+definition+header+file+c
read:
2025-02-21 06:55 AM
Hello,
Declare int i as static:
static int i;