Article View: comp.std.c
Article #4148Re: Question about making Static Libraries
From: "Dominic Monk"
Date: Sun, 01 Oct 1995 16:51
Date: Sun, 01 Oct 1995 16:51
46 lines
1253 bytes
1253 bytes
Re : Multiply defined symbols.
Under most linkers there are four main causes :
Using the same object file twice.
Linking using a lib ,and one of its component objects.
Undocumented names in vendor supplied libraries.
I think however, that you've got problems with your include files.
If you're making any sort of definition that reserves space in a header
file, then you can end up with duplicate names.
IE:
MyHead.h
int x=0;
UseFile1.c
#include <MyHead.h>
UseFile2.c
#include <MyHead.h>
This will cause 'x' to be defined once.
The header file should be changed to :
extern int x;
You shuld then create a file :
manifest.c
with
int x=6;
This also applies to pointers, ie
char * q;
This reserves space as well (the pointer itself, not what it points to)
Some linkers also resent
char * Msg = "John Major is cool";
DominiConnor
Technical Details
Message-ID:
<DFs45w.Cxy@cix.compulink.co.uk>Path:
arc1-ca.pugleaf.net!cix.compulink.co.uk!usenetReferences:
<44hcij$bi7@nn.fast.net>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!cix.compulink.co.uk!usenet
From: mod@cix.compulink.co.uk ("Dominic Monk")
Subject: Re: Question about making Static Libraries
Message-ID: <DFs45w.Cxy@cix.compulink.co.uk>
Organization: Bimbo R Us
References: <44hcij$bi7@nn.fast.net>
Date: Sun, 1 Oct 1995 16:51:32 GMT
X-News-Software: Ameol