目的:在matlab中调用c或c++语言编写的程序

2024-04-25 21:51:59
推荐回答(2个)
回答1:

你有没有先mex -setup? 先这样然后再mbuild -setup
我做了一下,给你参考:

>> 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] Intel C++ 9.1 (with Microsoft Visual C++ 2005 SP1 linker)
[2] Intel Visual Fortran 10.1 (with Microsoft Visual C++ 2005 SP1 linker)
[3] Intel Visual Fortran 9.1 (with Microsoft Visual C++ 2005 SP1 linker)
[4] Lcc-win32 C 2.4.1
[5] Microsoft Visual C++ 6.0
[6] Microsoft Visual C++ .NET 2003
[7] Microsoft Visual C++ 2005 SP1
[8] Microsoft Visual C++ 2008 Express
[9] Microsoft Visual C++ 2008 SP1
[10] Open WATCOM C++

[0] None

Compiler: 9

Your machine has a Microsoft Visual C++ 2008 SP1 compiler located at
e:\Microsoft Visual Studio 9.0. Do you want to use this compiler [y]/n? y

Please verify your choices:

Compiler: Microsoft Visual C++ 2008 SP1
Location: e:\Microsoft Visual Studio 9.0

Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2008 require
that Microsoft Visual Studio 2008 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:\MathWorks\MATLAB\R2009a\mexopts.bat
From template: E:\SOFTCT~1\MATLAB~2\bin\win32\mexopts\msvc90opts.bat

Done . . .

>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:

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

Select a compiler:
[1] Lcc-win32 C 2.4.1
[2] Microsoft Visual C++ 6.0
[3] Microsoft Visual C++ .NET 2003
[4] Microsoft Visual C++ 2005 SP1
[5] Microsoft Visual C++ 2008 Express
[6] Microsoft Visual C++ 2008 SP1

[0] None

Compiler: 2

The default location for Microsoft Visual C++ compilers is C:\Program Files\Microsoft Visual Studio,
but that directory does not exist on this machine.

Use C:\Program Files\Microsoft Visual Studio anyway [y]/n? y

Please verify your choices:

Compiler: Microsoft Visual C++ 6.0
Location: C:\Program Files\Microsoft Visual Studio

Are these correct [y]/n? y
Warning: MBUILD requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find these directories in 'C:\Program Files\Microsoft Visual Studio'.)
Trying to update options file:
C:\MathWorks\MATLAB\R2009a\compopts.bat
From template: E:\SOFTCT~1\MATLAB~2\bin\win32\mbuildopts\msvc60compp.bat

Done . . .

回答2:

当然不只是数学运算了,要不那么多病毒木马什么的就都靠边站了;要通过语言实现对操作系统的控制,就要知道系统的API,能过API中的各种接口,达到各种不同的操作;本人也只学了一点C,不太了解.但根据系统的API实现对系统的操作这个是绝对可以了,JAVA都行,更别说C了,WINDOWS就是用C写的