Effacer les filtres
Effacer les filtres

Error using MEX for C++ function in Matlab : error LNK2019: unresolved external symbol.

3 vues (au cours des 30 derniers jours)
sebastian bugna
sebastian bugna le 15 Juil 2015
Commenté : Geoff Hayes le 15 Juil 2015
Hi,
Im trying to compile a C++ algorithm but with many hurdles...
I found this error is very common and there are lots of links with similar questions; but I tried many modifications in the code and in the sentence when you call mex, but with any results.
My knowledge on C/C++ is little.
If you could please help me , thanks in advance.
I attach all my codes. Now they are all in the same folder, no space in the path names. Im neither loading no libraries with .lib. Just .cpp and .h files. Can't understand what's going wrong. Quite desperating.
The Main .cpp which Im trying to compile is algo.cpp , the rest of them are functions that are called from algo.cpp:
Heres my Error:
Error using mex Creating library algo.lib and object algo.exp algo.obj : error LNK2019: unresolved external symbol "public: float * __cdecl CImage::get_channel(int)" (?get_channel@CImage@@QEAAPEAMH@Z) referenced in function "unsigned int __cdecl buildMask(class CImage &,int *,unsigned int,unsigned int,unsigned int,unsigned int)" (?buildMask@@YAIAEAVCImage@@PEAHIIII@Z) algo.obj : error LNK2019: unresolved external symbol "public: __cdecl CImage::~CImage(void)" (??1CImage@@QEAA@XZ) referenced in function "void __cdecl algorithm(int,char * *)" (?algorithm@@YAXHPEAPEAD@Z) algo.obj : error LNK2019: unresolved external symbol fftwf_cleanup referenced in function "void __cdecl algorithm(int,char * *)" (?algorithm@@YAXHPEAPEAD@Z) algo.obj : error LNK2019: unresolved external symbol fftwf_cleanup_threads referenced in function "void __cdecl algorithm(int,char * *)" (?algorithm@@YAXHPEAPEAD@Z) algo.obj : error LNK2019: unresolved external symbol fftwf_destroy_plan referenced in function "void __cdecl algorithm(int,char * *)" (?algorithm@@YAXHPEAPEAD@Z) algo.obj : error LNK2019: unresolved external symbol "void __cdecl filter_curve(float *,float *,int,float *,int,bool)" (?filter_curve@@YAXPEAM0H0H_N@Z) referenced in function "void __cdecl algorithm(int,char * *)" (?algorithm@@YAXHPEAPEAD@Z)
  1 commentaire
Geoff Hayes
Geoff Hayes le 15 Juil 2015
Sebastien - you are probably missing one or more libraries that reference the the CImage class and the fftwf_ code. Rather than attaching a zip file (which many people might be reluctant to open) why not just attach the files? (Or are there too many to do that?)
Also, please describe how you are compiling your mex function.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur C Shared Library Integration dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by