I encountered a problem in my project as a function name, PropertyNotify() in couples of classes, in the FBX static library has already been defined as a macro int value in X11/X.h on Linux.
virtual bool PropertyNotify(eFbxPropertyCallback, KFbxProperty*); //kfbxobject.h
virtual bool PropertyNotify(eFbxPropertyCallback pType, KFbxProperty* pProperty); //kfbxnode.h
virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); //fbxmanipulators.h
virtual bool PropertyNotify(eFbxPropertyCallback pType, KFbxProperty* pProperty); //kfbxtexture.h
#define PropertyNotify 28 //X.h
The FBX is not open source and only provides the include headers and static and dynamic library (.a and .os), hence I can only include the FBX headers in my application but cannot touch the source files. I think the naming issue may be the caused of the compilation error "expected unqualified-id before numeric constant" I have got.
I tried calling "objcopy --redefine-sym PropertyNotify=FbxPropertyNotify libfbxsdk.a" in order to redefine the function name in the static library. By doing this, the "expected unqualified-id" error was solved, however, it seemed somehow messed up the static library because it caused hundreds of undefined references error in the codes where the FBX functions or objects being called.
I am wondering what is the solution to this issue? As suggested by someone, creating a wrapper of the FBX library could probably solve the problem. If that is possible, it would be very kind if anyone could share some detailed tutorial or guidance on how to implement it on Ubuntu. Thanks in advance.
Perhaps you might make a wrapper shared library which would link the
libfbx.so
. See this answer (describing how to build alibabc.so
linked tolib123.so
).But you really should ask the vendor of that FBX library for guidance. It could be that some other of theirs customers have met a similar issue, and they have already found out some workaround.
(intuitively, I don't recommend playing
objcopy
tricks on the proprietarylibfbx.so
)You might also customize your compiler (e.g. using MELT if working with GCC...) to have it handle specifically some particular names like
PropertyNotify
(but I am not sure it is a good idea, and it certainly takes weeks of efforts).