MATLAB: Using Coder’s generated C files in Visual Studio

matlab coder

[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

Best Answer

Assuming you're just generating the C++ code (and not creating a library), don't forget to add faceImage_initialize.cpp and faceImage_terminate.cpp to you VS project. Adding something to the linker's path won't do the job.
If you're creating a library using MATLAB Coder, then you need to add the library to the linker's input files in your VS project.
Related Question