Dear friends, I appreciate the Mathworks Support Team for their effort in answering the queries. But to the best of my knowledge & experience, the answer seems to be little beyond the actual scenario. I faced the same problem with the same error messages but I DID correct it very simply not by any method mentioned here.
SCENARIO BEFORE CORRECTION:
I had stored my files (the m file & wrapper c file) in a folder, namely:
D:\Research\MATLAB&C\MATLAB2C\CODEGEN\TutorialToMATLAB2C\CODERAND
THIS IS the problem: The folder names: "MATLAB&C" and "MATLAB2C" and TutorialToMATLAB2C".
I changed the folder names as:
D:\Research\MATLABAndC\MATLABToC\CODEGEN\TutorialToMATLABToC\CODERAND
This sorted out the problem.
My files:
1) The m file: coderand.m
function r = coderand()
r = rand();
2) The C wrapper file: main.c
/*
** main.c
*/
#include <stdio.h>
#include <stdlib.h>
#include "coderand.h"
#include "coderand_initialize.h"
#include "coderand_terminate.h"
int main()
{
coderand_initialize();
printf("coderand=%g\n", coderand());
coderand_terminate();
return 0;
}
3) The m script file: cccoderand.m
cfg = coder.config('exe');
cfg.CustomSource = 'main.c';
cfg.CustomInclude = 'D:\Research\MATLABAndC\MATLABToC\CODEGEN\TutorialToMATLABToC\CODERAND';
codegen -config cfg coderand;
That’s all friends. Thanks.