为什么“mex.h”中有一些错误?文件?
我在 Turbo C 中打开了一个 C 文件,以及这个 C 文件的开头看起来像这样:
#include <math.h>
#include <stdio.h>
#include "mex.h"
#include "matrix.h"
它使用一些 MATLAB 结构并在 C 中执行某些操作。 我检查了目录并确信它们是正确的。但是当我尝试编译它时,出现了一些错误(我只是复制一些并粘贴,它们看起来很相似):
错误 C:\MYFILE~1\TC2.0\MEX.H 1: 非法字符 '#' (0x23)
错误 C:\MYFILE~1\TC2.0\MEX.H 1:条件中文件意外结束...
错误 C:\MYFILE~1\TC2.0\MATRIX.H 1:表达式语法
出了什么问题?这些文件似乎有错误,但我只是将这些文件复制到正确的文件夹中......
I opened a C file in Turbo C, and the beginning of this C file looks like this:
#include <math.h>
#include <stdio.h>
#include "mex.h"
#include "matrix.h"
It uses some of the MATLAB structures and does something in C.
I checked the directory and am sure that they are right. But when I tried to compile it, some errors were (I just copy some and paste, they look similar):
Error C:\MYFILE~1\TC2.0\MEX.H 1: Illegal character '#' (0x23)
Error C:\MYFILE~1\TC2.0\MEX.H 1: Unexpected end of file in conditional...
Error C:\MYFILE~1\TC2.0\MATRIX.H 1: Expression syntax
What's wrong? It seems to be errors in these files, but I just copy these files into the correct folders...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MEX.H
的第 1 行似乎有一个杂散的“#”。如果没有看到文件,很难说问题出在哪里。 '#' 或注释之前可能有空格 - 但该行是有效的 #ifdef 行。很久以前(但可能是在 Turbo C 创建时),C 预处理器指令需要第 1 列中的“#”。
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.
涡轮C?严重地?好像20岁了。
(这是一个经典,我喜欢它......我不是在说它坏话。它只是不再适用。)
mex.h
现在肯定使用了在 Turbo 时代无效的方面C.或者,您需要做一些移植工作来修复
mex.h
和matrix.h
,或者您需要获得一个现代编译器(几个好的编译器是免费的) )。Turbo C? Seriously? It’s like 20 years old.
(It was a classic, and I loved it... I'm not badmouthing it. It’s 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
andmatrix.h
, or you need to get a modern compiler (several good ones are free).检查文件的日期是否类似于 1990 年,而不是 2010 年!
检查文件是否为纯 ASCII(开头没有 BOM)。
检查最后一行是否以换行符结尾。
如果您使用某些编辑器打开并保存该文件,它可能已更改为与 Turbo C 不兼容的格式。
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.