Xref: utzoo comp.unix.wizards:24385 comp.unix.questions:29258 Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!snorkelwacker.mit.edu!ai-lab!life!cracraft From: cracraft@pogo.ai.mit.edu (Stuart Cracraft) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: header file duplicate definitions advice sought Message-ID: Date: 8 Mar 91 02:41:34 GMT Sender: news@ai.mit.edu Organization: /home/fsf/cracraft/.organization Lines: 53 Hello! I am wondering if someone can help me with a problem I'm trying to resolve. How can you eliminate redefined errors in C when you have several thousand "#define"'s defined in both *.h and *.c files(about 2000 files combined)? Where *.h and *.c files are scattered around in different directories. So far I have only collected very few possible ideas to the problem. One of them is to have "#ifndef" statements over places that I am getting redefined errors. However, this is not a good solution because this will not work on case such as below: ========================================================================== inside abc.h inside def.h #define a 4 #define a 5 inside ghi.c #include #include Which value is ghi.c referring to, 4 or 5? Thus, I would end up searching in ghi.c to see which is a appropriate value and I might have to do this million times manually for other similar cases. Another idea is to list all the redefined symbols(using a script to retrieve) in following ways: header file symbol is symbol value located files including header files ------ ----- ----------- ---------------------------- a 5 abc.h def.h xyz.h kuy.c a 3 kby.h ubc.h ppp.h etc... This gives me more of general info which I might use it in changing the symbol name in the header file and also in files where header file is included. And I think this is a very clean solution except that again there are too many symbols(approximately 7000 of them) and I would end up spending million years. I have couple more ideas like above but they are not a good approach. Actually, I don't think there are any good simple way of resolving the problem but I am asking if anyone out there has/had similar experience to share with me how you have dealt with the problem. Thank you (sorry my question got little too lengthy :)