Using MPTK as a library, part 1

I am working on incorporating the MPTK library (0.7.0) into a JUCE application. Everything is fine, until I put only the line “#include ” in one of my files. (I am including “-l mptk”, and adding to the search paths “/usr/local/includes”.) Then, in XCode (4.6.3) I get these errors:
In file included from /Users/bobs/Aalborg/research/201307/mpdgui/mpdgui/Builds/MacOSX/../../Source/MainComponent.cpp:9:
/usr/local/include/mptk.h:1332:4: error: “No FFT implementation was found !”
# error “No FFT implementation was found !”
^
/usr/local/include/mptk.h:3217:78: error: unknown type name ‘GP_Pos_Book_c’
MPTK_LIB_EXPORT virtual MP_Support_t update_ip( const MP_Support_t *touch, GP_Pos_Book_c* );
^
/usr/local/include/mptk.h:3225:128: error: unknown type name ‘GP_Param_Book_c’
MPTK_LIB_EXPORT virtual void update_frame( unsigned long int frameIdx, MP_Real_t *maxCorr, unsigned long int *maxFilterIdx, GP_Param_Book_c* );
and so on. The first error I can get rid of by “#define HAVE_FFTW3 1” before the include of mptk.h. The second error and others I can get rid of by including in the header search paths, “/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk”
This leads me to my first question: why during the installation of mptk, it creates the libmptk.dylib, and creates and copies the mptk.h, but it does not copy all the other headers (which should already be in mptk.h) into the includes path? Is it expected to have to include the above source?
This doesn’t solve all errors. Now, I get the following:
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:67:3: error: unknown type name ‘MP_Signal_c’
MP_Signal_c *s;
^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:82:3: error: unknown type name ‘MP_Real_t’
MP_Real_t* atomBufferTemp;
^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:85:3: error: unknown type name ‘MP_Real_t’
MP_Real_t* frameBufferTemp;
and so on. This is strange because “MP_Signal_c” is defined in “mp_signal.h”, which is in “/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk”. Some of the errors go away if I put at the top of block.h the forward declaration, “class MP_Signal_c;” as well as “#include “mp_types.h”. But, then I get new errors:
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:126:3: error: unknown type name ‘MPTK_LIB_EXPORT’
MPTK_LIB_EXPORT virtual int plug_signal( MP_Signal_c *setSignal );
^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:126:19: error: expected member name or ‘;’ after declaration specifiers
MPTK_LIB_EXPORT virtual int plug_signal( MP_Signal_c *setSignal );
~~~~~~~~~~~~~~~ ^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:128:3: error: unknown type name ‘MPTK_LIB_EXPORT’
MPTK_LIB_EXPORT virtual ~MP_Block_c();
and so on. I can get rid of these errors by “#include “dsp_windows.h” in block.h. But now I get these errors:
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:163:45: error: unknown type name ‘TiXmlElement’
MPTK_LIB_EXPORT bool write_to_xml_element(TiXmlElement * blockElement);
^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:171:78: error: unknown type name ‘GP_Pos_Book_c’
MPTK_LIB_EXPORT virtual MP_Support_t update_ip( const MP_Support_t *touch, GP_Pos_Book_c* );
^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:179:128: error: unknown type name ‘GP_Param_Book_c’
MPTK_LIB_EXPORT virtual void update_frame( unsigned long int frameIdx, MP_Real_t *maxCorr, unsigned long int *maxFilterIdx, GP_Param_Book_c* );
and so on. I get rid of these errors when I include in block.h “#include “tinyxml.h”, the forward declarations “class GP_Pos_Book_c; class GP_Param_Book_c; class GP_Book_c; class MP_Atom_c; class MP_Dict_c;”. Then, I get new errors:
/usr/local/include/mptk.h:4305:39: error: unknown type name ‘GP_Block_Book_c’; did you mean ‘GP_Pos_Book_c’?
MPTK_LIB_EXPORT MP_Real_t update (GP_Block_Book_c*);
^
/Users/bobs/Aalborg/research/201307/MPTK-Source-0.7.0/src/libmptk/block.h:57:7: note: ‘GP_Pos_Book_c’ declared here
class GP_Pos_Book_c;
^
In file included from /Users/bobs/Aalborg/research/201307/mpdgui/mpdgui/Builds/MacOSX/../../Source/MainComponent.cpp:12:
/usr/local/include/mptk.h:7790:26: error: unknown type name ‘GP_Pos_Range_Sub_Book_c’
MPTK_LIB_EXPORT virtual GP_Pos_Range_Sub_Book_c* get_range_book(unsigned long int minPos,
^
where the problem is now in the installed mptk.h file. I delete the mptk.h in /usr/local/includes, and reinstall MPTK with the changes to the source above. This does not help. So, I see in mptk.h that the header having problems is dict.h. So, to dict.h I add the forward declarations “class GP_Block_Book_c; class GP_Pos_Range_Sub_Book_c;”. Then I remove mptk.h from /usr/local/includes, and reinstall it. This takes care of those errors, but then I get four more errors:
/usr/local/include/mptk.h:7803:51: error: return type of virtual function ‘get_range_book’ is not covariant with the return type of the function it overrides (‘GP_Pos_Range_Sub_Book_c’ is incomplete)
MPTK_LIB_EXPORT virtual GP_Pos_Range_Sub_Book_c* get_range_book(unsigned long int minPos,
^
/usr/local/include/mptk.h:8062:52: error: return type of virtual function ‘get_pos_book’ is not covariant with the return type of the function it overrides (‘GP_Pos_Range_Sub_Book_c’ is incomplete)
MPTK_LIB_EXPORT virtual GP_Pos_Range_Sub_Book_c* get_pos_book(unsigned long int pos);
^
/usr/local/include/mptk.h:8069:52: error: return type of virtual function ‘insert_pos_book’ is not covariant with the return type of the function it overrides (‘GP_Pos_Range_Sub_Book_c’ is incomplete)
MPTK_LIB_EXPORT virtual GP_Pos_Range_Sub_Book_c* insert_pos_book(unsigned long int pos);
^
/usr/local/include/mptk.h:8077:52: error: return type of virtual function ‘get_range_book’ is not covariant with the return type of the function it overrides (‘GP_Pos_Range_Sub_Book_c’ is incomplete)
MPTK_LIB_EXPORT virtual GP_Pos_Range_Sub_Book_c* get_range_book(unsigned long int minPos,unsigned long int maxPos);
Now, how do I resolve these errors?
I am hoping that these changes will make it more clear how to use the MPTK library in building a new application.
UPDATE: After ripping out all of gp (gradient pursuit), and modifying the relevant CMakeLists.txt, and reinstalling MPTK, I can now “#include ” without errors. MPTK-Source-0.7.0.zip

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s