This is the specific error I am getting:

libFoo.so: undefined reference to `IID_IFOOBAR'
collect2: ld returned 1 exit status
make: *** [/home/F.exe] Error 1

when I try to check the symbols in my object file A.o

nm A.obj | grep IID_

I get no symbols listed in my object file of the 'IID_IFOOBAR' that should be there since it is defined in a header file as:

extern const blahType IID_IFOOBAR

Am I missing something? Should IID_IFOOBAR be defined differently somewhere since it is an extern variable? If this question is too specific I will remove it. But perhaps someone's intuition will help me here.

+4  A: 

[EDIT] Add the definition of the variable somewhere (without extern). Extern identifiers without initializers are not definitions - the definition must be somewhere else.

But there should also be one (and only one) defintion in a .c/.cpp file somewhere.
Michael Burr
I shall accept this as the answer since it is right. I have found the problem. The definition needed to be in an unexpected place, so the extern can remain. Thanks!
I edited the answer a bit. The extern must be somewhere if you want to have external linkage, it's just that you need to have the definition also.
The `extern` keyword on a variable with an initialiser is _not_ ignored if the variable is also marked `const` since the `extern` in this case provides external linkage. Adding an initialiser in this case would have worked and satisfied the ODR. Of course the `extern` would then be pointless as the variable is defined everywhere that uses it. :)
Woops, I forgot about the fact the linker won't be happy about the multiple symbols _because_ it is marked extern.
+1  A: 

To make an externly declared symbol appear in your symbol table as "undefined", you should actually use it from within a library.

If your object file neither contains a definition of symbol (as opposed to declaration) nor uses it somewhere inside its functions, then the symbol won't appear in the symbol table. Why should it?

Pavel Shved