tags:

views:

34

answers:

1

Hi, I am facing a strange issue, but unable to simulate it a smaller scale. The problem is my symbol table has an entry of my extern symbols. These are declared in a header file. Defined in some other file - header.c

Header file

header.h

extern void rlog(int , char*, ...);
extern int SetGDebug(string);
extern int GDebug;

test.cpp C++ file

#include <header.h>

nm -CA test.o | grep De

00000000 B GDebug
00000b70 t global constructors keyed to GDebug
00000070 T SetGDebug()

compilation flags : -Wall -O2 -shared -fPIC -funroll-loops compiler :g++

This as expected is leading to multiple redefinition....

Another quick question...

Does an extern-nd symbol/function make it to the symbol table of the object file ?

+1  A: 

You don't need to declare functions extern, only variables.

DeadMG
Ricko M