Just can't get it working.  Here's my files.  If I am making this too complicated, let me know.

facedetect.cpp

std::string FaceDetect( std::string ImageFileName )
{
    // Code omitted
}

facedetect.cc

#ifndef facedetect_class
#define facedetect_class

#include "facedetect.cpp" // Include the main C/C++ program

using std namespace;

class Detect {

// Declare the class methods
public:
std::string do_detect(std::string filename); // This one is public

};

std::string Detect::do_detect(std::string filename) {
FaceDetect(filename);
}

#endif

facedetect_class.h

class Detect {
public:
extern std::string do_detect(std::string filename);
}

facedetect_class.i

%module capture
%include "std_string.i"
%apply const std::string& {std::string* foo};

%{
#include "facedetect_class.h"
%}

// List of all the methods of the class
%Capture::do_capture(std::string filename);

------------------------------------------------------

This call works fine...

swig -c++ -java facedetect_class.i

then when I try to run this...

g++ -c -fpic facedetect_class_wrap.cxx -I/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/include -I/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/include/linux

I get...

facedetect_class.h:5: error: storage class specified for ‘do_detect’
facedetect_class_wrap.cxx:221: error: expected unqualified-id before string constant

Any help would be greatly appreciated, been messing with this for a few hours.


Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. Learn more.