+2  A: 

OK, here's what I think the problem is but don't quote me on this ;)

The cppunit code uses a CPPUNIT_API macro to wrap up

__declspec(dllexport)

and

__declspec(dllimport)

when building on Win32. It doesn't use the equivalent

__attribute__ ((visibility("default")))

for gcc. This can cause problems when including that code in projects that do make use of the visibility attributes in gcc, most notably when the project uses the gcc command line flag

-fvisibility=hidden

to make all symbols private to the library by default and then using

__attribute__((visibility("default")))

in place of __declspec(dllexport/import) where appropriate. If a symbol, such as a vtable, is marked hidden in just one library, even though it is marked public in all other libraries, then apparently (see the link below) it is marked hidden and you get a linker error.

In your case the linker warnings that you get initially suggest that zxingcore-tests is being built with symbols hidden by default (check for that -f option when it's building) whereas xzingcore itself has them public. The symbols for the cppunit vtables will exist in cppunit, zxingcore and zxingcore-tests but are marked hidden in zxingcore-test and so they get hidden.

I think you need to try to find out why the zxingcore-tests build is hiding symbols and prevent it from doing that.

For further reading try the gcc wiki visibility page, particularly the section on "Problems with C++ exceptions" (and follow the link about vague linkage in there as well which shows it applies to vtables too). I'm vaguely familiar with this stuff because I've been bitten by dynamic_cast failures across libraries which, in that instance, are caused by the typeinfo objects getting hidden by mistake.

Troubadour
+1  A: 

I think the problem resided in the fact that the cppunit and zxingcore libraries were being built for armv6, whilst the zxingcore-tests was being built for an intel architecture. After chaging the configuration setting for zxingcore-tests to NATIVE_ARCH it seems to be compiling fine.

Andres
Actually that does make more sense given that you had linker errors for things other than vtables and typeinfo objects. If only I'd persevered with the simple `file` approach! lol.
Troubadour
A: 

I've experienced similar problems using libraries as well. I've been able to fix the problems by ensuring that the following are set in both project's build settings:

Under Target Info - Build - GCC 4.2 - Code Generation:

Ensure that both 'Inline Methods Hidden' and 'Symbols Hidden by Default' are turned off.

This may be a bit of a sledge hammer technique, but it works. If anyone can suggest a more fine grained way of removing this problem, I'd appreciate it.

George Sealy