How can I covert a c code to a MEX file?

Hi, I'm trying to convert a simple c code to a MEX file.I used the following command.
mex c_code.c
But it gives the following error.
c:\users\abrew\appdata\local\temp\mex_vgaoax\c_code.obj: multiple definition of _main
first definition is in file
c:\progra~2\matlab\r2008a\sys\lcc\lib\libcrt0.obj
Specified export _mexFunction is not defined
Missing exports. Aborting
C:\PROGRA~2\MATLAB\R2008A\BIN\MEX.PL: Error: Link of 'c_code.mexw32' failed.
??? Error using ==> mex at 207
Unable to complete successfully.
Can anyone help me to solve this issue.

 Respuesta aceptada

James Tursa
James Tursa el 20 de Jun. de 2013

1 voto

You should read the documentation on creating and compiling mex functions. You need a special interface function (mexFunction). E.g., you can start here for instructions and examples:

Más respuestas (0)

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Jun. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by