2013-02-22 87 views
3

我想編譯a matlab wrapper for libdc1394這是一個火線相機庫。 我得到一個奇怪的錯誤,涉及頭文件中的一些內聯函數。 我正在使用gcc-4.6工作在ubuntu 12.04上。我已經成功編譯了其他mex文件。這個包裝也很難在mac中編譯。mex不能識別內聯

/usr/local/MATLAB/R2012b//bin/mex dc1394mex.c `pkg-config --libs --cflags libdc1394-2` -o dc1394.mexa64 

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version 
     currently supported with MEX is "4.4.6". 
     For a list of currently supported compilers see: 
     http://www.mathworks.com/support/compilers/current_release/ 

In file included from /usr/include/dc1394/dc1394.h:53:0, 
       from dc1394mex.c:23: 
/usr/include/dc1394/register.h:47:1: error: unknown type name ‘inline’ 
/usr/include/dc1394/register.h:47:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dc1394_get_register’ 
/usr/include/dc1394/register.h:62:1: error: unknown type name ‘inline’ 
/usr/include/dc1394/register.h:62:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dc1394_set_register’ 
/usr/include/dc1394/register.h:82:1: error: unknown type name ‘inline’ 
/usr/include/dc1394/register.h:82:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dc1394_get_control_register’ 
/usr/include/dc1394/register.h:97:1: error: unknown type name ‘inline’ 
/usr/include/dc1394/register.h:97:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dc1394_set_control_register’ 
/usr/include/dc1394/register.h:117:1: error: unknown type name ‘inline’ 
/usr/include/dc1394/register.h:118:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dc1394_get_adv_control_register’ 
/usr/include/dc1394/register.h:133:1: error: unknown type name ‘inline’ 
/usr/include/dc1394/register.h:134:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dc1394_set_adv_control_register’ 
dc1394mex.c: In function ‘command_init_camera’: 
dc1394mex.c:133:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 
dc1394mex.c:152:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 
dc1394mex.c: In function ‘dcframe_to_mxframe’: 
dc1394mex.c:571:1: error: expected expression before ‘/’ token 
dc1394mex.c:572:1: error: expected expression before ‘/’ token 
dc1394mex.c:573:1: error: expected expression before ‘/’ token 

    mex: compile of ' "dc1394mex.c"' failed. 

make: *** [dc1394.mexa64] Error 1 

任何想法?

+2

嘗試添加'-std = c99' – Simon 2013-02-22 15:39:01

+1

MEX:-std = C99不正確的選項。 – sfotiadis 2013-02-22 15:54:35

回答

4

Well Simons的建議是正確的。只有抓住我不知道的是,你不能直接給mex cflags。你必須改變你的mexopts.sh文件。 另外我不得不刪除-ansi標誌,因爲它與c99相矛盾。

+0

非常有用!你救了我的早晨!我只需要弄清楚如何指定mex來考慮我的mexopts.sh文件。 mex選項-f取得了訣竅。 – pafede2 2014-06-24 07:18:04

4

如何在命令行上通過CFLAGS修改指定C99:

mex -v -largeArrayDims CFLAGS="\$CFLAGS -std=C99" dc1394mex.c