Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ncar!boulder!tramp!swarbric From: swarbric@tramp.Colorado.EDU (Frank Swarbrick) Newsgroups: comp.lang.c Subject: Re: Help needed with #include problems Message-ID: <6104@sigi.Colorado.EDU> Date: 18 May 88 03:02:06 GMT References: <28400001@ntvax> Sender: news@sigi.Colorado.EDU Reply-To: swarbric@tramp.Colorado.EDU (Frank Swarbrick) Organization: University of Colorado, Boulder Lines: 40 In article <28400001@ntvax> john@ntvax.UUCP writes: : :I am using Turboc 1.5 and am having problems linking files. I am writing :a large application (over 64k) and am having trouble breaking up the file. :The question is this, when I #include stdio, stdlib etc in multiple source :modules the compiler and linker have no problems, however, this is not the :case when i #include my own header files. The compile goes ok but the linker :gives me the following error - "variable name here" is duplicated in module :"source module name here" . This only occurs for my specfic header files not :the system (stdio, etc). What can I do to get around this problem. Using :extern may help but the header file is very large. Variables can only be declaired once without the "extern" keyword. The compiler's header files don't include any variables. That's why they compile just fine. Your's shouldn't either, but if you must, do something like this... ----file.c---- #define _FILE #include int var; /* do more stuff */ ---end file.c--- ----file.h---- #ifndef _FILE extern int var; #endif ---end file.h--- ---file2.c---- #include /* you can now use "var" */ ---end file2.c--- Hope this makes some sense... I also could have sworn you had to do this with typedefs, but I just tried something and it looks like maybe not. I dunno. You'll have to try it yourself. Frank Swarbrick (and his cat) swarbric@tramp.Colorado.EDU ...!{ncar|nbires}!boulder!tramp!swarbric "We've seen each other's hands. What else is there?"