Answer the question
In order to leave comments, you need to log in
Gcc multiple definition of ..., what is the correct way to declare variables that are used in multiple files?
Hello. Added the C++ tag, because the problem is most likely a general one for C and C++. I'm delving into C, I'm not writing on the plus signs yet.
There is a Makefile
config_parser.o: config_parser.c ews.h
gcc -c config_parser.c
ews.o: ews.c ews.h
gcc -c ews.c
ews: config_parser.o ews.o
gcc --std=c99 config_parser.o ews.o -o ews
Answer the question
In order to leave comments, you need to log in
It's right not to do that. You will say that in one file you have foo = 1, and in another foo = 0. And how does the compiler know where it should be? At what point in time should it change from zero to one? And in general, which of the two is implied in each line of code ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question