Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

MEX-file error: Afx.h not found

2 visualizzazioni (ultimi 30 giorni)
Mana V
Mana V il 19 Nov 2015
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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?

Risposte (1)

Walter Roberson
Walter Roberson il 19 Nov 2015
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 Commenti
Walter Roberson
Walter Roberson il 23 Nov 2015
Please show the error log.
Mana V
Mana V il 23 Nov 2015
Modificato: Mana V il 23 Nov 2015
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

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by