plugin accessing fileIOFilter

Feel free to ask any question here
Post Reply
ankitmutha
Posts: 6
Joined: Fri Feb 07, 2014 9:27 pm

plugin accessing fileIOFilter

Post by ankitmutha »

Hi All,

I have created a plug-in that is trying to access AsciiFilter::LoadFromFile and AsciiFilter::SaveToFile methods.
However, when I compile my plug-in I get the following errors:
--------------------------------------------------------------------------------------------

2>------ Build started: Project: QMOD_PLUGIN_DLL, Configuration: Debug Win32 ------
2> Creating library C:/Users/amutha/Desktop/CloudComapreVS2010/qCC/plugins/qMOD/Debug/QMOD_PLUGIN_DLLd.lib and object C:/Users/amutha/Desktop/CloudComapreVS2010/qCC/plugins/qMOD/Debug/QMOD_PLUGIN_DLLd.exp
2>MODObjectTableModel.obj : error LNK2019: unresolved external symbol "public: static enum CC_FILE_ERROR __cdecl FileIOFilter::SaveToFile(class ccHObject *,char const *,enum CC_FILE_TYPES)" (?SaveToFile@FileIOFilter@@SA?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4CC_FILE_TYPES@@@Z) referenced in function "public: void __thiscall MODObjectTableModel::saveSelectedEntities(void)" (?saveSelectedEntities@MODObjectTableModel@@QAEXXZ)
2>qMOD.obj : error LNK2019: unresolved external symbol "public: static class ccHObject * __cdecl FileIOFilter::LoadFromFile(class QString const &,enum CC_FILE_TYPES,bool,bool *,class Vector3Tpl<double> *)" (?LoadFromFile@FileIOFilter@@SAPAVccHObject@@ABVQString@@W4CC_FILE_TYPES@@_NPA_NPAV?$Vector3Tpl@N@@@Z) referenced in function "protected: void __thiscall qMOD::showFiles(class QList<class MODObject *> *)" (?showFiles@qMOD@@IAEXPAV?$QList@PAVMODObject@@@@@Z)
2>C:\Users\amutha\Desktop\CloudComapreVS2010\qCC\plugins\qMOD\Debug\QMOD_PLUGIN_DLLd.dll : fatal error LNK1120: 2 unresolved externals
--------------------------------------------------------------------------------------------


I am using the latest code from github and as you can see compiling on Windows using VS2010.
My CMakeList.txt is as follows:
--------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)

#REPLACE ALL 'MOD' OCCURENCES BY YOUR PLUGIN NAME
#AND ADAPT THE CODE BELOW TO YOUR OWN NEEDS!

option( INSTALL_QMOD_PLUGIN "Check to install qMOD plugin" OFF )

if (INSTALL_QMOD_PLUGIN)

#CloudCompare 'MOD' plugin
project( QMOD_PLUGIN_DLL )

#load necessary libraries (see qPCV for an example)

#if the plugin is an 'OpenGL filter', uncomment the line below
#set( CC_OPENGL_FILTER ON BOOL)
include( ../CMakePluginTpl.cmake )

#set dependencies to necessary libraries (see qPCV for an example)
target_link_libraries( ${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/qjson/lib/qjson.lib )

include_directories( qjson/include)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )

endif()
--------------------------------------------------------------------------------------------

Can somebody provide any useful guidance for me to compile my plugin?

Regards,
Ankit
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: plugin accessing fileIOFilter

Post by daniel »

You have to include the AsciiFilter.h/.cpp files in your plugin project.

Look at the qSRA plugin for instance:

Code: Select all

	#need to link with AsciiFilter class
	file( GLOB CC_PLUGIN_CUSTOM_HEADER_LIST ${CloudCompare_SOURCE_DIR}/fileIO/AsciiFilter*.h )
	file( GLOB CC_PLUGIN_CUSTOM_SOURCE_LIST ${CloudCompare_SOURCE_DIR}/fileIO/AsciiFilter*.cpp )
Just add this under the "project( QMOD_PLUGIN_DLL )" line.

You can also replace "AsciiFilter*.h" by "*.h" if you need other file filters or if you just don't want to bother.
Daniel, CloudCompare admin
ankitmutha
Posts: 6
Joined: Fri Feb 07, 2014 9:27 pm

Re: plugin accessing fileIOFilter

Post by ankitmutha »

Thanks daniel for quick reply.

I would like to use other filters as well, so I included all the source files in fileIO folder
But I get the following errors on compilation:

Code: Select all

 Creating library C:/Users/amutha/Desktop/CloudComapreVS2010/qCC/plugins/qMOD/Debug/QMOD_PLUGIN_DLLd.lib and object C:/Users/amutha/Desktop/CloudComapreVS2010/qCC/plugins/qMOD/Debug/QMOD_PLUGIN_DLLd.exp
2>VTKFilter.obj : error LNK2001: unresolved external symbol "public: static bool __cdecl ccCoordinatesShiftManager::Handle(double const *,double,bool,bool,class Vector3Tpl<double> &,double *,bool &)" (?Handle@ccCoordinatesShiftManager@@SA_NPBNN_N1AAV?$Vector3Tpl@N@@PANAA_N@Z)
2>AsciiFilter.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl ccCoordinatesShiftManager::Handle(double const *,double,bool,bool,class Vector3Tpl<double> &,double *,bool &)" (?Handle@ccCoordinatesShiftManager@@SA_NPBNN_N1AAV?$Vector3Tpl@N@@PANAA_N@Z) referenced in function "public: enum CC_FILE_ERROR __thiscall AsciiFilter::loadCloudFromFormatedAsciiFile(char const *,class ccHObject &,class std::vector<struct AsciiOpenDlg::SequenceItem,class std::allocator<struct AsciiOpenDlg::SequenceItem> > const &,char,unsigned int,__int64,unsigned int,unsigned int,bool,bool *,class Vector3Tpl<double> *)" (?loadCloudFromFormatedAsciiFile@AsciiFilter@@QAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@ABV?$vector@USequenceItem@AsciiOpenDlg@@V?$allocator@USequenceItem@AsciiOpenDlg@@@std@@@std@@DI_JII_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>ObjFilter.obj : error LNK2001: unresolved external symbol "public: static bool __cdecl ccCoordinatesShiftManager::Handle(double const *,double,bool,bool,class Vector3Tpl<double> &,double *,bool &)" (?Handle@ccCoordinatesShiftManager@@SA_NPBNN_N1AAV?$Vector3Tpl@N@@PANAA_N@Z)
2>PlyFilter.obj : error LNK2001: unresolved external symbol "public: static bool __cdecl ccCoordinatesShiftManager::Handle(double const *,double,bool,bool,class Vector3Tpl<double> &,double *,bool &)" (?Handle@ccCoordinatesShiftManager@@SA_NPBNN_N1AAV?$Vector3Tpl@N@@PANAA_N@Z)
2>STLFilter.obj : error LNK2001: unresolved external symbol "public: static bool __cdecl ccCoordinatesShiftManager::Handle(double const *,double,bool,bool,class Vector3Tpl<double> &,double *,bool &)" (?Handle@ccCoordinatesShiftManager@@SA_NPBNN_N1AAV?$Vector3Tpl@N@@PANAA_N@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_write referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_close referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_write_header referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_add_obj_info referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_add_comment referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_add_list_property referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_add_scalar_property referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_add_element referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_create referenced in function "protected: enum CC_FILE_ERROR __thiscall PlyFilter::saveToFile(class ccHObject *,char const *,enum e_ply_storage_mode_)" (?saveToFile@PlyFilter@@IAE?AW4CC_FILE_ERROR@@PAVccHObject@@PBDW4e_ply_storage_mode_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_read referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_set_read_cb referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_next_obj_info referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_property_info referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_next_property referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_element_info referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_next_element referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_next_comment referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _get_plystorage_mode referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_read_header referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_open referenced in function "public: virtual enum CC_FILE_ERROR __thiscall PlyFilter::loadFile(char const *,class ccHObject &,bool,bool *,class Vector3Tpl<double> *)" (?loadFile@PlyFilter@@UAE?AW4CC_FILE_ERROR@@PBDAAVccHObject@@_NPA_NPAV?$Vector3Tpl@N@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_argument_value referenced in function "int __cdecl vertex_cb(struct t_ply_argument_ *)" (?vertex_cb@@YAHPAUt_ply_argument_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_argument_user_data referenced in function "int __cdecl vertex_cb(struct t_ply_argument_ *)" (?vertex_cb@@YAHPAUt_ply_argument_@@@Z)
2>PlyFilter.obj : error LNK2019: unresolved external symbol _ply_get_argument_property referenced in function "int __cdecl rgb_cb(struct t_ply_argument_ *)" (?rgb_cb@@YAHPAUt_ply_argument_@@@Z)
2>C:\Users\amutha\Desktop\CloudComapreVS2010\qCC\plugins\qMOD\Debug\QMOD_PLUGIN_DLLd.dll : fatal error LNK1120: 24 unresolved externals
Are there other files to be included?
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: plugin accessing fileIOFilter

Post by daniel »

Almost the same thing here:
- add the ccCoordinatesShiftManager.h/.cpp files
- add the rply.h/.c files (warning the extension is '.c' here instead of '.cpp')
Daniel, CloudCompare admin
ankitmutha
Posts: 6
Joined: Fri Feb 07, 2014 9:27 pm

Re: plugin accessing fileIOFilter

Post by ankitmutha »

Thanks again!

The compilation worked this time.

However the plug-in was not loaded with message:

Code: Select all

[15:02:22] [Plugin] Cannot load library C:/Users/amutha/Desktop/CloudComapreVS2010/build/CloudCompare/plugins/QMOD_PLUGIN_DLL.dll: The specified module could not be found.
How should I start debugging this?
ankitmutha
Posts: 6
Joined: Fri Feb 07, 2014 9:27 pm

Re: plugin accessing fileIOFilter

Post by ankitmutha »

After reading a bit, I understand that if the plugin depends on a library (qjson in this case) and if that is not found at run time then this error is reported.
I tried to put qjson.dll in the application folder but it still did not work.

Can anyone suggest how should I actually link qjson library with my plug-in?
ankitmutha
Posts: 6
Joined: Fri Feb 07, 2014 9:27 pm

Re: plugin accessing fileIOFilter

Post by ankitmutha »

Finally I got it working. I am using QtNetwork and I had to add that to the

Code: Select all

install_Qt_Dlls
Thanks again for helping out.
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: plugin accessing fileIOFilter

Post by daniel »

I'm glad you managed to sort that out all by yourself because I would never have guessed the 'QtNetwork' issue ;)

Is it a plugin that you'll keep on your side or do you intend to share it one day with the community? I'm just asking because of the customization of the 'install_Qt_Dlls' function. If you want to share it at some point in the future we'll have to find a cleaner way to do this.
Daniel, CloudCompare admin
ankitmutha
Posts: 6
Joined: Fri Feb 07, 2014 9:27 pm

Re: plugin accessing fileIOFilter

Post by ankitmutha »

Hi Daniel,

The plugin actually connects to a web application that I built to store the point cloud and mesh models. I do not think its generic enough to be useful to anyone else.
Thank you very much for the support and for your great project!
daniel
Site Admin
Posts: 7713
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: plugin accessing fileIOFilter

Post by daniel »

Just to warn you that with the latest trunk version (>= 2.5.3) all the I/O filters are now in a separate library (QCC_IO_LIB).

Therefore, in place of dependencies to the CloudCompare project, plugins just have to add in their CMakeList.txt file:

Code: Select all

include( ../CMakePluginTpl.cmake )
[...]
include_directories( ${QCC_IO_LIB_SOURCE_DIR} )
target_link_libraries( ${PROJECT_NAME} QCC_IO_LIB )
Daniel, CloudCompare admin
Post Reply