i writing plugin autodesk maya using c++ , have linker error.
my main class maya_search_plugin.cpp
#include <utilities.h> declaresimplecommand( search_face, plugin_company, "4.5"); //doit method entry point plugin mstatus search_face::doit( const marglist& ) { //calls maya types/functions , utilities functions }
then have utilities class containing static methods header looking this
#ifndef __maya_cpp_plugin__utilities__ #define __maya_cpp_plugin__utilities__ //#pragma once //standard libs #include <stdio.h> #include <time.h> #include <string.h> #include <iostream> #include <math.h> //maya libs #include <maya/mdagpath.h> #include <maya/mfn.h> #include <maya/mfileio.h> #include <maya/miostream.h> #include <maya/mfnmesh.h> #include <maya/mfntransform.h> #include <maya/mglobal.h> #include <maya/mselectionlist.h> #include <maya/msimple.h> #include <maya/mtypes.h> #include <maya/mpointarray.h> #include <maya/mobjectarray.h> class utilities{ public: static const int max_mov = 50; public: static double get_mesh_error(mpointarray, mpointarray, int); static mstatus translatemanipulator(double amount, mobject *path); static void getselected(mobjectarray* objects, mfn::type type); }; #endif /* defined(__maya_cpp_plugin__utilities__) */
with implementation this
#include <utilities.h> double utilities::get_mesh_error(mpointarray a, mpointarray b, int vertexcount){ ... } mstatus utilities::translatemanipulator(double amount, mobject *path){ ... } void utilities::getselected(mobjectarray* objects, mfn::type type) { ... }
however getting following error
duplicate symbol _mapiversion in: /users/tmg06qyu/library/developer/xcode/deriveddata/maya_cpp_plugin-hjrwvybwlvqyyscbmixdkcpdzjqr/build/intermediates/maya_cpp_plugin.build/debug/maya_cpp_plugin.build/objects-normal/x86_64/maya_search_plugin.o /users/tmg06qyu/library/developer/xcode/deriveddata/maya_cpp_plugin-hjrwvybwlvqyyscbmixdkcpdzjqr/build/intermediates/maya_cpp_plugin.build/debug/maya_cpp_plugin.build/objects-normal/x86_64/utilities.o ld: 1 duplicate symbol architecture x86_64 command /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/ld failed exit code 1
which presume linking error , there circular reference somewhere, can't work out is.
any appreciated.
thanks.
i know year old. stumbled on again couple minutes ago...
add
#define mnoversionstring #define mnopluginentry #include <maya/mfnplugin.h>
to header or cpp files wrote plugin code. include
#include <maya/mfnplugin.h>
directly in main.cpp initializes plugin.
most of examples in maya have following string:
// added prevent multiple definitions of mapiversion string. #define _mapiversion
before including anything. example here.
Comments
Post a Comment