View Full Version : undefined symbols on macOsX

03-16-2007, 12:34 AM
Hi there. I have a problem compiling a plug-in for maya on Mac using XCode.
These simple line:

MFnAnimCurve fn;

gimme an error. I know may think: did you include the file MFnAnimCurve.h? Yes. I've talked for half an hour witha friend that is a windows user and he has no problem. Even beacuse this line is so simple.

The error shown:

undefined symbols:
vtable for MFnAnimCurve
collect2: Id returned 1 exit status

Non sense thing.
Can somebody help me on this? I've searched on google also, some people have the same problem with xcode and their problems are due to some destructors as in my case. But I cannot modify the file .h cause I have not the permissions and however I don't want to modify the .h maya files.

Any idea?

03-16-2007, 01:30 AM
The error doesn't really say much, you'd need to look at the source code. All it's telling you is that the destructor (which the compiler seems to be looking for amongst the virtual overloads based on the "vtable" line, could be wrong on that) has been declared but not defined, trouble is there could be any number of causes, e.g. maybe if the struct/class only contains that destructor and no other functions you may be missing the corresponding cpp file in the project that contains the definition of the MFnAnimCurve::~MFnAnimCurve(), another possibility, is MFnAnimCurve a pure virtual class perhaps designed to only be overloaded before allocation? Do a search through all the files in the API for the destructor definition, it's possible that it's not defined in the cpp file that shares the same name as the header file you're looking in. Sometimes errors don't show up on the PC, when they will do when you come to compile on the Mac, this may just be an error in the API itself.

Perhaps you should contact Autodesk developer support? I wouldn't recommend filling in destructors in an API unless you really know what you're doing as it's very easy to cause bad behaviour such as memory leaks and general instability.

Ian Jones
03-16-2007, 04:39 AM
Yeah more information please, this is hard to diagnose.

03-16-2007, 04:08 PM
Chances are really good that you're not linking in the necessary libraries.

It might be easier opening one of the examples in the dev/plug-ins directory and modifying it. Those should compile out of the box.

03-16-2007, 04:25 PM
That is a linking error by the looks of it. The h file gives you the prototypes so the compiler knows the functions exist but you need to link in the precompiled library file.

You may have to add a search path for the lib depending on where it is, but if it's still not linking you may have to explicitly link the libfile with your code.

I don't have any experience with XCode so I'm not sure where the options would be but if you bring up something like 'linker options' and add something like -l MFnAnimCurve (assuming the libfile is libMFnAnimCurve.o) to the linker command it might work, assuming the liker works in a reasonably standard way.

03-17-2007, 01:31 AM
Thanks very much for the help. The error was I wasn't importing the -lOpenMayaAnim lib.

I've found the solution searching in the maya examples.

Sorry for the the disturb.


CGTalk Moderation
03-17-2007, 01:31 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.