From: Jan Simon on
Dear Sapna,

> I have managed to compile it without giving the previous error.

It is helpful for the newsgroup, if you post, how do you solved your problem.

> But now the error that is popping up is this
> Error qp.c: C:\PROGRA~1\MATLAB\R2009B\sys\lcc\include\math.h: 8 syntax error; found `extern' expecting `;'
>
> extern double _HUGE ;
>
> Do you know what could be wrong?

The compiler tells, that the error happens in "math.h" line 8, and not in the "extern double _HUGE" line.
Without seeing the source, I'm not able to guess the cause of the problem. What appears directly before "#include <math.h>"? If there is an invalid statement, LCC might be confused and locates the error inside the included file.
Another idea is the symbol "_HUGE". All uppercase and a leading underscore - this looks like a compiler defined symbol. Could try a more convenient looking name?

> There was an existing code on qp.c and pr_logo.c which i modified slightly and now trying to compile it. Is this possible?

Of course you can modify C source successfully as long as you do not insert bugs.

Good luck, Jan
From: kk KKsingh on
"Sapna " <sapna.ds(a)gmail.com> wrote in message <i1o2eo$8rj$1(a)fred.mathworks.com>...
> Hi Jan,
>
> I have managed to compile it without giving the previous error. But now the error that is popping up is this
>
> Error qp.c: C:\PROGRA~1\MATLAB\R2009B\sys\lcc\include\math.h: 8 syntax error; found `extern' expecting `;'
>
> This is happening now that I am trying to create a debug version of this dll by using
>
> mex -g qp.c pr_logo.c
>
> and this is when it is giving me this error. A function in matlab calls this qp.c and qp.c in turn calls pr_logo.c. pr_logo has a .h file called math.h that it is using. It is giving error in this line
>
> extern double _HUGE ;
>
> There is a semi-colon there already. I don't know why it is popping up an error.
>
> There was an existing code on qp.c and pr_logo.c which i modified slightly and now trying to compile it. Is this possible? I initially wrote the code in qp.c but now transferred it to pr_logo.c to check if it was still giving the error. Do you know what could be wrong?
>
> Thanks,
> "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i1ne60$hn8$1(a)fred.mathworks.com>...
> > Dear Sapna,
> >
> > > I have copied both qp.c and pr_logo.c in the current directory i.e.,
> > > C:\PROGRA~1\MATLAB\R2009B\extern\examples\mex
> >
> > I'd recommend not to use folders in Matlab's program directory. It is even no good idea to have write permissions for these folders (exception: "<matabroot>\toolbox\local", but even this can/should/might be secured).
> >
> > > How should I compile the code without it reporting an error? I used
> > > 1) mex -setup
> > > 2) mex qp.c pr_logo.c
> >
> > I do not expect that your problem is caused by the writing permissions of the folder. Anyway, you could copy both C-files to a location in your user path or to TEMP and try the compilation again. If really both files are found in the current directory, the error is strange. Perhaps you could add the folder to your Matlab path ("addpath(cd, '-end')"?!
> >
> > Good luck, Jan

sapna try gcc

AKi