mayuejun 发表于 2011-3-12 19:39

如何把VC++源文件 转换成 在matlab下 可以使用的文件

求助:如何把VC++源文件 转换成 在matlab下 可以使用的文件?
我想把这个tree.c 文件转换,提示错误如下:请问是什么原因?谢谢指教!
mex -setup
Please choose your compiler for building external interface (MEX) files:

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

Select a compiler:
Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
Lcc C version 2.4.1 in D:\MATLAB\sys\lcc
Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio

None

Compiler: 3

Please verify your choices:

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

Are these correct?(/n): y

Try to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template:            D:\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 tree.c
tree.c
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(24) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(24) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(71) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(71) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(73) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(73) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(74) : error C2061: syntax error : identifier 'wstreampos'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(74) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(76) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(76) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(137) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(137) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(176) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(176) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(215) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(215) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(217) : error C2061: syntax error : identifier 'ios_base'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(217) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(218) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(218) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(220) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(220) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(222) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(222) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(224) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(224) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(226) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(226) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(228) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(228) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(230) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(230) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(232) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(232) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(235) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(235) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(238) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(238) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(241) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(241) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(244) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(244) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(246) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(246) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(248) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(248) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(250) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(250) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(254) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(254) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(255) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(255) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(256) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(256) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(257) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(257) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(258) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(258) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(259) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(259) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(261) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(261) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(263) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(263) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(265) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(265) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(267) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(267) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(268) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(268) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(269) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(269) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(270) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(270) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(272) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(272) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(273) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(273) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(275) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(275) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(276) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(276) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(277) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(277) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(278) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(278) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(280) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(280) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(282) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(282) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(284) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(284) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(286) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(286) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(287) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(287) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(288) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(288) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(289) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(289) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(292) : error C2143: syntax error : missing '{' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\iosfwd(292) : fatal error C1003: error count exceeds 100; stopping compilation

D:\MATLAB\BIN\MEX.PL: Error: Compile of 'tree.c' failed.

??? Error using ==> mex
Unable to complete successfully

gagmeng 发表于 2011-3-18 12:08

看一下混合编程吧

zhouyang664 发表于 2011-3-18 12:18

依我看,是源文件 tree.c 有语法错误吧!
error C2143: syntax error : missing '{' before '<'
error C2059: syntax error : '<'

这应该不是matlab的问题
页: [1]
查看完整版本: 如何把VC++源文件 转换成 在matlab下 可以使用的文件