안녕하십니까, 안녕하십니까,SWIG 인터페이스에 C++ 클래스가 없습니다.
C++에서 SWIG 인터페이스를 작동시키는 데 문제가 있습니다.
/* File : AlgoritmoElectrico.i */
%module alg
/* Header files that are referred in the ones I want to create the interface with */
%{
#include "AlgoritmoElectrico.h"
#include "Proyecto.h"
#include "Indice.h"
/* ... I skipped a few to make it shorter ... */
#include "ParserTime.h"
%}
/* Header files of classes I want to use in Java */
%include "AlgoritmoElectrico.h"
%include "AlgoritmoElectrico.h"
: 나는 그러므로 내 .I 파일처럼 보이는, 그들 모두의 난 단지 (내 자바 코드에 사용되는) 몇 가지에 대한 인터페이스를 만들려면 여러 .CPP 및 .H 파일이 따라서 swig -c++ -java AlgoritmoElectrico.i
을 실행하고 여러 .java 파일과 .cxx 래퍼를 가져 와서 모든 .java 파일을 javac *.java
으로 컴파일하고 네이티브 및 래퍼 코드로 .so 라이브러리를 만들었습니다.
내 자바 코드는 다음과 같습니다
package mr;
/* ... Stuff ... */
public class MRAlgoritmo {
public static class Map extends Mapper<LongWritable, Text, IntWritable, Text> {
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
// Obtiene instante y circulaciones
Pattern pattern = Pattern.compile("\t[ ||| ]"); // FIXME revisar regex
String[] info = pattern.split(value.toString());
// Captura datos de proyecto
System.loadLibrary("algoritmo");
Proyecto proyecto = new Proyecto("Proyecto1");
proyecto.ReadFile("infraestructura");
proyecto.getParametros().setIntervalo(1);
// Ejecuta algortimo con datos de circulaciones
AlgoritmoElectrico algoritmo = new AlgoritmoElectrico(proyecto);
String [] resultados = algoritmo.Ejecutar(info);
/* ... stuff ... */
}
}
public static void main(String[] args) throws Exception {
/* ... stuff not related with the above, working with Hadoop MR ... */
}
}
Proyecto
와 AlgoritmoElectrico
는 C++ 클래스 그리고 그들이 발견되지 않습니다. 아이디어?
감사합니다.