![](/img/trans.png)
[英]Myo armband gestures in MATLAB (Unable to compile the .m or .mex file)
[英]Unable to compile MEX
我正在嘗試從C ++源代碼編譯一些MATLAB MEX文件。 我試圖編譯的文件可以在這里找到 ; 我在32位系統,MATLAB 2012a上使用Windows XP,並安裝了Microsoft Windows SDK v7.1作為我的編譯器。
如果我嘗試編譯,MATLAB輸出以下錯誤:
>> mex -O -largeArrayDims osc_free_address.c
osc_free_address.c
osc_free_address.c(1) : error C2059: syntax error : '<'
osc_free_address.c(37) : error C2015: too many characters in constant
osc_free_address.c(38) : error C2059: syntax error : '<'
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(41) : error C2018: unknown character '0x40'
osc_free_address.c(43) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(46) : error C2059: syntax error : '<'
osc_free_address.c(82) : fatal error C1021: invalid preprocessor command 'page'
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'osc_free_address.c' failed.
Error using mex (line 206)
Unable to complete successfully.
我使用mex -setup設置我的編譯器與Microsoft Windows SDK v7.1 。 有趣的是,雖然我有他們我的系統上安裝,MATLAB並不見MS Visual Studio的C ++ 2008 或 2010年。我也試圖與LCC-將Win32 C編譯器2.4.1(這是由MATLAB識別)編制,以相同效果如上圖所示。
我知道這個特定的C ++源文件集可能需要一些名為liblo的東西來編譯(我不確定這是編譯時還是運行時的要求); 據我所知,我已經正確安裝了這些,但問題可能也存在於此。
任何幫助將不勝感激。
嘗試將.c
文件重命名為.cpp
並重新編譯
>> mex -largeArrayDims -O osc_free_address.cpp
此外,為什么不嘗試包中附帶的build m文件(如本問題所示 )?
你下載並編譯了liblo嗎? 您可能需要在mex
命令中為它添加包含路徑和庫路徑?
>> mex -largeArrayDims -O -I<liblo include path> -L<liblo lib path> -llo osc_free_address.cpp
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.