Linker problem

When going to compile a program I am working on there is an error with the linker that I don't completely understand. It is a duplicate symbol error but the symbol in question is an instance of a struct which is defined in an include file (must be global). I am confused as to why I am getting this. The IDE is Xcode on Mac Os X 10.7 (Lion), intel 64 bit.

The exact error is "ld: duplicate symbol _ssf"
ssf is the instance.

As always thank you very much for any help/input.
You've got more than one instance of it created and they're conflicting. It should identify the object files that both contain it.
Multiple files/functions share the object. Also the object is declared with the definition of the structure. Can you clarify what the issue is, I am not sure I fully understand.
It may be easier if you show the code.
If you want a global variable shared along cpps, declared it asextern. You will need to define it somewhere (just one time)
the code looks like this
1
2
3
4
5
//database.h
struct somestruct{
string variable;
int variable
}ssf[10];

there are a bunch of functions that use the data in ssf. Would I use extern in this case? Isn't extern just for variables?
Isn't extern just for variables?


ssf is a variable.
Last edited on
ssf is a variable.

Touche
Last edited on
so do ssf have to declared ssf in the file i am using the structure or where i declared it .
Topic archived. No new replies allowed.