gpt4 book ai didi

matlab - 在Matlab中使用mex编译C++时,如何摆脱stdafx.h错误?

转载 作者:行者123 更新时间:2023-12-02 10:42:48 24 4
gpt4 key购买 nike

我正在尝试使用mex编译C++代码,但无法成功编译它。阅读一些相关的博客,我同时安装了Microsoft Visual C++ 2010 Express和Windows软件开发工具包(SDK)7.1,但仍然出现此错误:

facePart.cpp(5) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory



任何人都可以帮助我解决问题...?

我正在将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. ************************************************************************

最佳答案

从您的代码中删除#include“stdafx.h”,或创建一个空的stdafx.h。

确保C:\ Users \ JOY \ AppData \ Roaming \ MathWorks \ MATLAB \ R2011a \ mexopts.bat不包含/Yu“stdafx.h”之类的选项

关于matlab - 在Matlab中使用mex编译C++时,如何摆脱stdafx.h错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16183133/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com