Info

此问题已关闭。 请重新打开它进行编辑或回答。

MEX-file error: Afx.h not found

1 次查看(过去 30 天)
Mana V
Mana V 2015-11-19
关闭: MATLAB Answer Bot 2021-8-20
Hello,
I wrote a MATLAB code that uses mex-file with a computer that uses windows 32bits, and this code worked. Then, I imported this code on an other computer that uses windows 64bits (I'm still building this code with Microsoft Windows SDK 7.1 - C++) and I have the following error: C:\users\documents\matlab\StdAfx.h(19): fatal error C1083: Cannot open include file: 'Afx.h': No such file or directory
I made some researches about my issues, and I think it could be a compatibility error, but I cannot find how to solve it, do you have any idea?

回答(1 个)

Walter Roberson
Walter Roberson 2015-11-19
Comment out the #include stdafx.h line. It is an optimization for some microsoft compilers, so at worst your program will compile more slowly.
  3 个评论
Mana V
Mana V 2015-11-23
编辑:Mana V 2015-11-23
There :
>> 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

此问题已关闭。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by