Q:

SWIGs std_vector.i works on one file, but not both

I am using SWIG in android to convert a bunch of c++ code I have into java.  I have one function that will read data out of a file, and another that will take that data and process it.  Both use 
vector<complex<float> >

The problem is that building it gets me the following error
[javac]         do_something_with_data.work(return_data.read(num_samps));
[javac]              ^
[javac]   required: SWIGTYPE_p_vectorT_complexT_float_t_t
[javac]   found: vector_complex_float
[javac]   reason: actual argument vector_complex_float cannot be converted to SWIGTYPE_p_vectorT_complexT_float_t_t by method invocation conversion
[javac] 1 error

I find it interesting that it works for one, but not the other.  What am I doing wrong?
Here are the .i files
/* turn this module into java using SWIG */                                      
%module do_something_with_data                                                                 

%{                                                                               
#include <vector>                                                                
#include <complex>                                                               
#include "do_something_with_data.hh"                                               
%}                                                                               

/* Let's just grab the original header file here */                              
%include "std_vector.i"                                                          

namespace std {                                                                  
%template(vector_complex_float) vector<complex<float> >;                     
}                                                                                

/* boilerplate code */                                                           
%pragma(java) jniclasscode=%{                                                    
  static {                                                                       
    try {                                                                        
      java.lang.System.loadLibrary("do_something_with_data");                                  
    } catch (UnsatisfiedLinkError e) {                                           
      java.lang.System.err.println("Native code library failed to import");      
      java.lang.System.exit(1);                                                  
    }                                                                            
  }                                                                              
%}                                                                               

%include "do_something_with_data.hh"    

and the other .i file
/* turn this module into java using SWIG */                                      
%module return_data                                                                 

%{                                                                               
#include <vector>                                                                
#include <complex>                                                               
#include "return_data.hh"                                               
%}                                                                               

/* Let's just grab the original header file here */                              
%include "std_vector.i"                                                          

namespace std {                                                                  
%template(vector_complex_float) vector<complex<float> >;                     
}                                                                                

/* boilerplate code */                                                           
%pragma(java) jniclasscode=%{                                                    
  static {                                                                       
    try {                                                                        
      java.lang.System.loadLibrary("return_data");                                  
    } catch (UnsatisfiedLinkError e) {                                           
      java.lang.System.err.println("Native code library failed to import");      
      java.lang.System.exit(1);                                                  
    }                                                                            
  }                                                                              
%}                                                                               

%include "return_data.hh"    

I compile both using the following script
swig -c++ -java -package do_something_with_data -outdir src/do_something_with_data -o jni/do_something_with_data/do_something_with_data.cc jni/do_something_with_data/do_something_with_data.i
swig -c++ -java -package return_data            -outdir src/return_data            -o jni/return_data/return_data_wrap.cc                  jni/return_data/return_data.i

I know I've given a lot of code, but it's probably important for me to add the definitions of the functions as well.  These are in the .hh files in the class declaration.
int32 work(vector<complex<float> > &input_items);  

and 
vector<complex<float> > read(int num_samps);   

Thank you in advance for your help.

A:

There were two main questions that I was asking.  First, why are types different, and second, how do I make them play nicely with each other.  I managed to solve both.
First, the types were different because of one line that was missing in the header file included by the .i files.  Putting "using namespace std;" in all of the included .hh files allowed the following block to work.
namespace std {                                                                  
    %template(vector_complex_float) vector<complex<float> >;                     
}

The second part of the question was answered above, although I used a slightly different method.  I created one .i file that included all of the packages that I was interested in.  That resulted in the following code:
/* turn this module into java using SWIG */
%module er_java

%{
    #include <vector>
    #include <complex>
    #include "read_data.hh"
    #include "do_something_with_data.hh"
%}

/* Let's just grab the original header file here */
%include "std_vector.i"
%include "std_string.i"

namespace std {
    %template(vector_complex_float) vector<complex<float> >;
    %template(vector_float) vector<float>;
}    

/* boilerplate code */
%pragma(java) jniclasscode=%{
  static {
    try {
      java.lang.System.loadLibrary("read_data");
      java.lang.System.loadLibrary("do_something_with_data");
    } catch (UnsatisfiedLinkError e) {
      java.lang.System.err.println("Native code library failed to import");
      java.lang.System.exit(1);
    }
  }
%}

%include "read_data/read_data.hh"
%include "do_something_with_data/do_something_with_data.hh"

and built everything with the following line
 swig -c++ -java -package er_java  -outdir src/er_java  -o jni/project/er_java_wrap.cc jni/swig_libs.i

Just don't forget to compile the resulting wrap.cc file in your project's Android.mk

