M
mdh
I decided to make a single file containing all the repetitive
functions in K&R so that I could concentrate on the new discussions.
This went along just fine, and with each new function, added the
declaration to foo.h and the function to foo.c. Then, on one
compilation, I suddenly got a massive number of failures and warnings.
Like
"Redefinition errors. errors complaining about a variable not having
been declared, when it was etc"
Finally turns out that I had duplicated a declaration in the header
file, which solved all the disparate warnings.
I have a couple of questions.
1) I thought it made no difference if a definition is declared more
than once?
2) To the more experienced C programmers, if one suddenly gets
widespread warnings and failures to compile, is this something you
would automatically think of? ie a duplicate declaration. ( It took me
a few hours of removing each function/declaration before it was
obvious what the error was).
Thanks
functions in K&R so that I could concentrate on the new discussions.
This went along just fine, and with each new function, added the
declaration to foo.h and the function to foo.c. Then, on one
compilation, I suddenly got a massive number of failures and warnings.
Like
"Redefinition errors. errors complaining about a variable not having
been declared, when it was etc"
Finally turns out that I had duplicated a declaration in the header
file, which solved all the disparate warnings.
I have a couple of questions.
1) I thought it made no difference if a definition is declared more
than once?
2) To the more experienced C programmers, if one suddenly gets
widespread warnings and failures to compile, is this something you
would automatically think of? ie a duplicate declaration. ( It took me
a few hours of removing each function/declaration before it was
obvious what the error was).
Thanks