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 件のコメント
Walter Roberson
Walter Roberson 2015 年 11 月 23 日
Please show the error log.
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