tags:

views:

69

answers:

3
+1  A: 

There seems to be a stray '#' on line 1 of MEX.H.

Without seeing the file, it is hard to say what the problem is. It might be that there are blanks before the '#', or a comment - but the line is an otherwise valid #ifdef line. Once upon a long time ago (but possibly when Turbo C was created), C preprocessor directives needed the '#' in column 1.

Jonathan Leffler
@ Jonathan Leffler, thank you! do you agree with abelenky that this might be the problem of the complier itself?
serina
It might be a case of `# ifndef` - note the space between `#` and `ifndef`
MSalters
@MSalters, I check the mex.h, no space between # and ifndef...everywhere is #ifndef
serina
@serina: yes, the problem is in mex.h. On line 1. So, show us exactly what the first 10 lines or so contain, and maybe we can help. The point about Turbo C being seriously ancient is also relevant. However, that would be more likely to affect later lines than line 1 in a header.
Jonathan Leffler
@Jonathan, Hi, thank you very much for these answers, I have found the reasons: it requires several other header files that I did not provide together, when I put in all the necesscary header files, it worked fine, but I got another problem, what I wanna do is to generate a dll file that python could call this c file. I tried it in Cygwin and use the gcc commands, it worked fine to get a *.o file, then I use the infor from google and get a .*so file, then in python, I do import ctypes, then it worked ok according to the instructions. but how to do it in windows, as it uses "cl", don't know it
serina
@serina: wrong person to ask - I don't "do Windows". I don't know if Turbo C can create DLLs. You'd need to read its documentation. I believe GCC under Cygwin can create DLLs; I've not made it do so myself (though I have occasionally use GCC under Cygwin for Unix programming on Windows).
Jonathan Leffler
+2  A: 

Turbo C? Seriously? Its like 20 years old.
(It was a classic, and I loved it... I'm not bad mouthing it. Its just no longer applicable.)

mex.h surely uses aspects now that were not valid in the days of Turbo C.

Either, you need to do some porting work to fix up mex.h and matrix.h, or you need to get a modern compiler (several good ones are free).

abelenky
+1 -- seriously, nobody is even attempting compatibility with Turbo C anymore, and I doubt Matlab would even be able to use a binary produced with it (Considering it can produce only 16 bit applications)
Billy ONeal
Good point Billy! Even if you get it past Turbo C's pre-processor and compiler, the 16-bit output will likely be useless.
abelenky
@hahahaha, I use the VS studio actually, but for this, I found TC might be smarter. Ok... I am out~
serina
+2  A: 

Check that the date of the file is something like 1990, not 2010!

Check that the file is plain ASCII (no BOM at the beginning).
Check that the last line ends with a line break.

If you opened and saved the file with some editor, it may have been changed to a format incompatible with Turbo C.

pmg
@pmg, thank you,I see, why there are such many miseries
serina