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

时间:2015-11-25 09:04:28

标签: 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':没有这样的文件或目录

当我评论该行" #include" 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"背后的代码。文件:

// 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);

我对我的问题进行了一些研究,我认为这可能是一个兼容性错误,但我找不到如何解决它,你有什么想法吗?

0 个答案:

没有答案