C MATLAB Mex文件错误:未找到Afx.h

C MATLAB Mex文件错误:未找到Afx.h,c,matlab,mex,C,Matlab,Mex,我编写了一个MATLAB代码,使用mex文件和一台使用windows 32位的计算机,这段代码运行正常。然后,我在另一台使用windows 64位的计算机上导入了此代码(我仍在使用Microsoft windows SDK 7.1-C++构建此代码),出现以下错误:C:\users\documents\matlab\StdAfx.h(19):致命错误C1083:无法打开包含文件:“Afx.h”:没有此类文件或目录 当我注释“包含”STDAFX.h“在我从MATLAB调用的C++文件中,我有以下错

我编写了一个MATLAB代码,使用mex文件和一台使用windows 32位的计算机,这段代码运行正常。然后,我在另一台使用windows 64位的计算机上导入了此代码(我仍在使用Microsoft windows SDK 7.1-C++构建此代码),出现以下错误:C:\users\documents\matlab\StdAfx.h(19):致命错误C1083:无法打开包含文件:“Afx.h”:没有此类文件或目录

当我注释“包含”STDAFX.h“在我从MATLAB调用的C++文件中,我有以下错误日志:

>> readTest
Building with 'Microsoft Windows SDK 7.1 (C++)'.
Error using mex
Test704.cpp
c:\users\icm\documents\matlab\704IO.h(6) : error C2146: syntax error : missing ';'
before identifier 'EXPORT'
c:\users\icm\documents\matlab\704IO.h(6) : error C2146: syntax error : missing ';'
before identifier 'PortRead'
c:\users\icm\documents\matlab\704IO.h(6) : error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
c:\users\icm\documents\matlab\704IO.h(6) : error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
c:\users\icm\documents\matlab\704IO.h(7) : error C2146: syntax error : missing ';'
before identifier 'EXPORT'
c:\users\icm\documents\matlab\704IO.h(7) : error C2182: 'WINAPI' : illegal use of
type 'void'
c:\users\icm\documents\matlab\704IO.h(7) : error C2371: 'WINAPI' : redefinition;
different basic types
        c:\users\icm\documents\matlab\704IO.h(6) : see declaration of 'WINAPI'
c:\users\icm\documents\matlab\704IO.h(7) : error C2146: syntax error : missing ';'
before identifier 'PortWrite'
c:\users\icm\documents\matlab\704IO.h(7) : error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
c:\users\icm\documents\matlab\704IO.h(7) : error C2086: 'int EXPORT' : redefinition
        c:\users\icm\documents\matlab\704IO.h(6) : see declaration of 'EXPORT'
c:\users\icm\documents\matlab\704IO.h(7) : error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
C:\Users\ICM\Documents\MATLAB\Test704.cpp(14) : error C2146: syntax error : missing
';' before identifier 'theApp'
C:\Users\ICM\Documents\MATLAB\Test704.cpp(14) : error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
C:\Users\ICM\Documents\MATLAB\Test704.cpp(14) : error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
C:\Users\ICM\Documents\MATLAB\Test704.cpp(42) : warning C4244: 'argument' :
conversion from 'double' to 'short', possible loss of data
C:\Users\ICM\Documents\MATLAB\Test704.cpp(42) : warning C4244: 'argument' :
conversion from 'double' to 'short', possible loss of data
C:\Users\ICM\Documents\MATLAB\Test704.cpp(42) : warning C4244: 'argument' :
conversion from 'double' to 'short', possible loss of data
C:\Users\ICM\Documents\MATLAB\Test704.cpp(53) : warning C4244: 'return' :
conversion from 'double' to 'int', possible loss of data
下面是“704IO.h”文件背后的代码:


<>我对我的问题做了一些研究,我认为这可能是一个兼容性错误,但是我找不到解决它的方法,你有什么想法?< /P>什么是在704?h的第一行中引起了爆炸?你能把线1-7?这可能是一些非标准C++,现代编译器不再让我飞了?我会检查你的SP。特定版本的Matlab支持特定的编译器。此外,您提到的错误“C:\users\documents\Matlab\StdAfx.h(19):致命错误C1083:无法打开包含文件:“Afx.h”:没有这样的文件或目录”不在您列出的日志中?以下是704IO.h文件包含的全部内容(第1行至第7行):
//704IO.h:导出704IO DLL的头文件
//
#pragma一次
外部“C”短WINAPI导出端口读取(短机架、短端口、短偏移);
外部“C”void WINAPI导出端口写入(短机架、短端口、短偏移、短值);
(1)您应该把这部分704IO.h放在问题中。(2)#pragma表示编译器指令,编译器指令可能特定于特定的编译器!我猜代码中有一个新编译器无法理解的指令,但旧编译器可以理解。我的错误是,我编辑了关于“C:\users\documents\matlab\StdAfx.h(19)这一事实的问题不能打开的包含文件:“AFX.H”:没有这样的文件或目录“没有在错误日志中,并添加了704IO .h的代码。所以你认为我应该改变我的C++编译器,或者我应该简单地评论“γ-PrimaMa1”行吗?
// 704IO.h : export header file for the 704IO DLL
//

#pragma once

extern "C" short WINAPI EXPORT PortRead(short Rack, short Port, short Offset);
extern "C" void WINAPI EXPORT PortWrite(short Rack, short Port, short Offset, short Value);