lundi 1 septembre 2014

Linking and Compiling C library Undefined symbols. Predeclaration in another file to implementation


Vote count:

0




Okay so I am experiencing some issues with compiling and linking a C library (LibJXR from Microsoft) with a predeclaration in one file and the implementation in another. (Building FreeImage 3.16 for iOS)


The compiling part is successful, however the linking not so much (however I do believe the issue is in the compiling though).


So this is what I know. I have a file called "decode.c" which has a Predeclaration to a function called "AdaptHighpassDec", however this is implemented in another c file called "segdec.c".


Stack of errors when building against lib with a target of i386 (Xcode)



Undefined symbols for architecture i386:
"_AdaptHighpassDec", referenced from:
_ResetCodingContextDec in freeimage.a(decode.o-i386)
"_AdaptLowpassDec", referenced from:
_ResetCodingContextDec in freeimage.a(decode.o-i386)
"_DecodeMacroblockDC", referenced from:
_processMacroblockDec in freeimage.a(strdec.o-i386)
_WMPhotoTranscode in freeimage.a(JXRTranscode.o-i386)
"_DecodeMacroblockHighpass", referenced from:
_processMacroblockDec in freeimage.a(strdec.o-i386)
_WMPhotoTranscode in freeimage.a(JXRTranscode.o-i386)
"_DecodeMacroblockLowpass", referenced from:
_processMacroblockDec in freeimage.a(strdec.o-i386)
_WMPhotoTranscode in freeimage.a(JXRTranscode.o-i386)
ld: symbol(s) not found for architecture i386


So I believe what is happening is "AdaptHighpassDec" is built into the strdec.o-i386 object and so when the linker is saying, oh hey there is no "AdaptHighpassDec" in "decode.o-i386" which was declared here. The other errors I believe to be the same problem however with different functions.


So without major source file reworking, is there a way I can resolve this, like compiling the objects into one? Or should I just merge the other c file into the main one and only compile that one all together.


I am using makefile to build the library and a custom script which I can share if helpful



asked 55 secs ago







Linking and Compiling C library Undefined symbols. Predeclaration in another file to implementation

Aucun commentaire:

Enregistrer un commentaire