J
Jose Luis
Hi,
Given the code below:
<<<snip begin>>>
m3vmsa3.rraaupma /tmp > more p1.c p2.c defs.h
#include "defs.h"
int main()
{}
....skipping...
#include "defs.h"
....skipping...
#ifndef DEFS_H
#define DEFS_H
const char* STR1="Hello World";
const int i1=0;
#endif
<<<snip end>>>
If compiled:
m3vmsa3.rraaupma /tmp > aCC p1.c p2.c
p1.c:
p2.c:
/usr/ccs/bin/ld: Duplicate symbol "STR1" in files p1.o and p2.o
/usr/ccs/bin/ld: Found 1 duplicate symbol(s)
What is the best option for STR1: "static const" or "#define"?
Why is "i1" not a duplicate symbol?
Thanks in advance,
Jose Luis.
Given the code below:
<<<snip begin>>>
m3vmsa3.rraaupma /tmp > more p1.c p2.c defs.h
#include "defs.h"
int main()
{}
....skipping...
#include "defs.h"
....skipping...
#ifndef DEFS_H
#define DEFS_H
const char* STR1="Hello World";
const int i1=0;
#endif
<<<snip end>>>
If compiled:
m3vmsa3.rraaupma /tmp > aCC p1.c p2.c
p1.c:
p2.c:
/usr/ccs/bin/ld: Duplicate symbol "STR1" in files p1.o and p2.o
/usr/ccs/bin/ld: Found 1 duplicate symbol(s)
What is the best option for STR1: "static const" or "#define"?
Why is "i1" not a duplicate symbol?
Thanks in advance,
Jose Luis.