Using Coder's generated C files in Visual Studio ?
Mostrar comentarios más antiguos
[EDIT: 20110608 10:34 CDT - reformat - WDR]
Hello Folks,
I have successfully changed my .m files to .c files using Matlab Coder. May you guide me on how to use these files in Visual Studio ?
my function name is faceImage.c
In my Visual Studio .cpp file, I included:
#include "faceImage.h"
#include "faceImage_initialize.h"
#include "faceImage_terminate.h"
But when i compile the file i get:
error LNK2019: unresolved external symbol "void __cdecl faceImage_initialize(void)" (?faceImage_initialize@@YAXXZ) referenced in function _wmain
Can you please give me an example or any reference that may aid me to solve such problem.
Loads of thanks
Respuesta aceptada
Más respuestas (1)
Kaustubha Govind
el 8 de Jun. de 2011
2 votos
Have you included faceImage.c in your Visual Studio project?
Note that if you are calling C functions from C++ files, you need to include the extern "C" directive: How do I call a C function from C++?
You might need to add this to the generated header files for all functions that you intend to call from a .cpp file.
2 comentarios
Chirag Gupta
el 8 de Jun. de 2011
As Kaustubha pointed it out, just add "C" in all the header files:
Instead of extern void face_initiallize(...), just make it
extern "C" void face_initialize(...)
Louis
el 8 de Jun. de 2011
Categorías
Más información sobre MATLAB Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!