Как я могу избавиться от ошибки stdafx.h при компиляции C ++ с mex в Matlab?

Я пытаюсь скомпилировать код C ++ с помощью mex, но не могу его успешно скомпилировать. Читая некоторые связанные блоги, я установил Microsoft Visual C ++ 2010 Express и Windows Software Development Kit (SDK) 7.1, но все равно выдает эту ошибку:

facePart.cpp (5): фатальная ошибка C1083: не удается открыть включаемый файл: 'stdafx.h': нет такого файла или каталога

Кто-нибудь может помочь мне разобраться в проблеме, пожалуйста ...?

Я использую 64-битную платформу Windows с версией Matlab 2011a ...

Кстати, после ввода mex -setup я получаю что-то вроде этого:

Please choose your compiler for building MEX-files:

Would you like mex to locate installed compilers [y]/n? y

Select a compiler: [1] Microsoft Visual C++ 2010 Express in C:\Program Files (x86)\Microsoft Visual Studio 10.0

[0] None

Compiler: 1

Please verify your choices:

Compiler: Microsoft Visual C++ 2010 Express Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0

Are these correct [y]/n? y

************************************************************************* Warning: MEX-files generated using Microsoft Visual C++ 2010 require that Microsoft Visual Studio 2010 run-time libraries be available on the computer they are run on. If you plan to redistribute your MEX-files to other MATLAB users, be sure that they have the run-time libraries. *************************************************************************

Trying to update options file: C:\Users\JOY\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat From template: C:\PROGRA~1\MATLAB\R2011a\bin\win64\mexopts\msvc100freeopts.bat

Done . . .

************************************************************************ Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9 Building with the -largeArrayDims option enables the new API. ************************************************************************

person Joy    schedule 24.04.2013    source источник
comment
в вашем коде есть #include stdafx.h?   -  person Bull    schedule 24.04.2013
comment
Привет, Антон, да, есть   -  person Joy    schedule 24.04.2013
comment
Тебе это не нужно. См. Следующий связанный вопрос: Какая польза от «stdafx.h» ”В Visual Studio?   -  person Eitan T    schedule 24.04.2013


Ответы (1)


Удалите из кода #include "stdafx.h" или создайте пустой stdafx.h.

Убедитесь, что C: \ Users \ JOY \ AppData \ Roaming \ MathWorks \ MATLAB \ R2011a \ mexopts.bat не содержит параметр типа / Yu "stdafx.h"

person Bull    schedule 24.04.2013