#ifndef b_h #include" b.h" #endif #ifndef c_h #include" c.h" #endif #ifndef d_h #include" d.h" #endif #ifndef application_h #include" application.h" #endif 然后这个main.h包含在每个.c和.h文件中...... 我以为这个也是一个很好的方法 你怎么看? well in my program, i do have a situation where i need to makeeverything(almost) visible to everyone.which is why i was considering the all.h approach. My project is basedon ray tracing. You have module like - 1. Ray ( Basic Data structure , initialization of rays, creation ofreflected rays, shadow rays etc) 2. Geometry File Reader ( Reads the geometry into my data structures) 3. Octree ( For spatial subdivision of the 3D object) 4. Vector module ( Vector data structure, basic vector functions.) 5. Ray Tracing Module (To keep track of rays) 6. Ray - Triangle Intersection ModuleAs you can see they are all more or less dependent on each other. Oneapproach that I saw soemwhere was to define a main.h file. There were many files in the project - a.ha.c b.hb.c c.hc.c d.hd.c application.h main.cmain.h In this, application.h was containing some common #defines, prototypesof functions in main.c and it included standard headers like stdio,math, string etc. main.h was like this - #ifndef a_h#include "a.h"#endif #ifndef b_h#include "b.h"#endif#ifndef c_h#include "c.h"#endif#ifndef d_h#include "d.h"#endif #ifndef application_h#include "application.h"#endif Then this main.h was included in every .c and .h file...I thought this was also a neat approach What do you think ? broli说: broli said: 在我的程序中,我确实有一种情况我需要制作 所有人(几乎)都能看到。 well in my program, i do have a situation where i need to makeeverything(almost) visible to everyone. 在拖钓小组之前你应该想到这一点。你现在将在 相当多的杀戮文件。 - Richard Heathfield< http:/ /www.cpax.org.uk> 电子邮件:-http:// www。 + rjh @ 谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php> Usenet是一个奇怪的放置" - dmr 1999年7月29日 You should have thought of that before trolling the group. You''ll be inquite a few killfiles by now. --Richard Heathfield <http://www.cpax.org.uk>Email: -http://www. +rjh@Google users: <http://www.cpax.org.uk/prg/writings/googly.php>"Usenet is a strange place" - dmr 29 July 1999 这篇关于管理标题的最佳方法..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 09:12