2013-07-11 2 views
2

C++을 사용하여 Autodesk Maya 용 플러그인을 작성 중이며 링커 오류가 있습니다.C++에 문제가 포함됨

내 주요 클래스는 내가 헤더 일부 정적 메서드를 포함하는 유틸리티 클래스는이

#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) { 
    ... 
} 
같은 구현이

#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__) */ 

처럼 보이는 한 다음

#include <Utilities.h> 

DeclareSimpleCommand(search_face, PLUGIN_COMPANY, "4.5"); 

//doIt method is entry point for plugin 
MStatus search_face::doIt(const MArgList&) 
{ 
    //calls to Maya types/functions and Utilities functions 
} 

Maya_Search_Plugin.cpp

입니다

그러나 다음 오류가 발생합니다.

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 for architecture x86_64 
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld failed with exit code 1 

나는 연결 오류이며 어딘가에 순환 참조가 있지만 어디에서 작동하지 않을 수 있습니다.

도움을 주시면 감사하겠습니다.

감사합니다.

+0

Maya 버전이 문제가 될 수 있습니다. XCode 버전? – Korchkidu

+0

Maya 2014, Xcode 4.6.3 – shaw2thefloor

+0

예, devkit 데모 자료에 표시된대로 기본 클래스의 매크로를 사용하고 있습니다. – shaw2thefloor

답변

3

나는 이것이 1 년 전임을 알고있다. 하지만

당신이 당신의 플러그인 코드를 작성 헤더 또는 CPP 파일에
#define MNoVersionString 
#define MNoPluginEntry 
#include <maya/MFnPlugin.h> 

추가 ... 몇 분 전에 다시에 발견.

#include <maya/MFnPlugin.h> 

을 플러그인을 초기화하는 main.cpp에 직접 포함 시키십시오.

// This is added to prevent multiple definitions of the MApiVersion string. 
#define _MApiVersion 

아무것도 포함하기 전에 : 마야의 예제의 대부분

는 다음과 같은 문자열을 가지고있다. 예 : here.

0

MFnPlugin.h가 포함 된 파일이 여러 개있는 경우