日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

(实验学习)MATLAB与C/C++混合编程之MATLAB调用C程序,转载的

發布時間:2025/7/14 c/c++ 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 (实验学习)MATLAB与C/C++混合编程之MATLAB调用C程序,转载的 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

轉載源于:http://hi.baidu.com/renrsh/blog/item/69c664117abe0b18b9127bc1.html

>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
[2] Lcc C version 2.4.1 in D:\SOFTWARE\MATLAB\sys\lcc
[3] Microsoft Visual C/C++ version 6.0 in d:\software\C_installer
[0] None
Compiler: 3
Please verify your choices:
Compiler: Microsoft Visual C/C++ 6.0
Location: d:\software\C_installer
Are these correct?([y]/n):

Warning: Mex requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find a directory named "Common" in the directory 'd:\software\C_installer'.)?? 強烈懷疑是安裝vc++時候,文件夾不統一,這個可能會造成一些問題..

顯然,自己沒有安裝vc98

Try to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template:????????????? D:\SOFTWARE\MATLAB\BIN\win32\mexopts\msvc60opts.bat
Done . . .
***************************************************************************
? Warning: The file extension of 32-bit Windows MEX-files was changed
?????????? from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated?
?????????? MEX-file will not be found by MATLAB versions prior to 7.1.
?????????? Use the -output option with the ".dll" file extension to
?????????? generate a MEX-file that can be called in previous versions.
?????????? For more information see:?
?????????? MATLAB 7.1 Release Notes, New File Extension for MEX-Files on Windows
***************************************************************************

>> mex hello.c????????????????????????????????????????????????????????????????????????????????????????????????? ?????????? (已經把hello.c放在當前目錄下的,)
? Could not find the compiler "cl" on the DOS path.
? Use mex -setup to configure your environment properly.
? D:\SOFTWARE\MATLAB\BIN\MEX.PL: Error: Unable to locate compiler.
??? Error using ==> mex
Unable to complete successfully

>>

修改一下:

>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
[2] Lcc C version 2.4.1 in D:\SOFTWARE\MATLAB\sys\lcc
[3] Microsoft Visual C/C++ version 6.0 in d:\software\C_installer
[0] None
Compiler: 2
Please verify your choices:
Compiler: Lcc C 2.4.1
Location: D:\SOFTWARE\MATLAB\sys\lcc
Are these correct?([y]/n): y
Try to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template:????????????? D:\SOFTWARE\MATLAB\BIN\win32\mexopts\lccopts.bat
Done . . .
***************************************************************************
? Warning: The file extension of 32-bit Windows MEX-files was changed
?????????? from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated?
?????????? MEX-file will not be found by MATLAB versions prior to 7.1.
?????????? Use the -output option with the ".dll" file extension to
?????????? generate a MEX-file that can be called in previous versions.
?????????? For more information see:?
?????????? MATLAB 7.1 Release Notes, New File Extension for MEX-Files on Windows
***************************************************************************
>>? mex hello.c

>>? $表明成功地編譯
>> mex abc.cpp
lcc preprocessor warning: abc.cpp:5 EOF inside comment
lcc preprocessor warning: abc.cpp:5 No newline at end of file
Error abc.cpp: 5? syntax error; found `*' expecting `)'
Error abc.cpp: 5? skipping `*' `p' `,'
Error abc.cpp: 5? missing identifier
Error abc.cpp: 5? syntax error; found `int' expecting `;'
Error abc.cpp: 5? syntax error; found `)' expecting `;'
Error abc.cpp: 5? skipping `)'
Error abc.cpp: 5? declared parameter `Width' is missing
Error abc.cpp: 5? declared parameter `Height' is missing
Error abc.cpp: 5? syntax error; found `end of input' expecting `{'
Error abc.cpp: 5? syntax error; found `end of input' expecting `}'
10 errors, 2 warnings
? D:\SOFTWARE\MATLAB\BIN\MEX.PL: Error: Compile of 'abc.cpp' failed.
??? Error using ==> mex
Unable to complete successfully

>> hello
hello,world!

解決方案:

>> mex -setup

Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? N
Select a compiler:
[1] Borland C++Builder version 6.0? 所以考慮用這個編譯器.
[2] Borland C++Builder version 5.0
[3] Borland C++Builder version 4.0
[4] Borland C++Builder version 3.0
[5] Borland C/C++ version 5.2
[6] Borland C/C++ version 5.0
[7] Borland C/C++ (free command line tools) version 5.5

[8] Digital Visual Fortran version 6.0
[9] Digital Visual Fortran version 5.0
[10] Lcc C version 2.4.1
[11] Microsoft Visual C/C++ version 7.0
[12] Microsoft Visual C/C++ version 7.1
[13] Microsoft Visual C/C++ version 6.0
[14] Microsoft Visual C/C++ version 5.0
[15] Open WATCOM C/C++ version 1.3
[16] WATCOM C/C++ version 11
[17] WATCOM C/C++ version 10.6

他們的主頁:http://info.borland.com/devsupport/bcppbuilder/patches/?這個基本上無速度.

??????????????????? http://www.rsdown.cn/downinfo/2122.html?這個網站不要亂點.

?

轉載于:https://www.cnblogs.com/fleetwgx/archive/2009/05/16/1458373.html

總結

以上是生活随笔為你收集整理的(实验学习)MATLAB与C/C++混合编程之MATLAB调用C程序,转载的的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。