mex无法识别内联

时间:2013-02-22 15:28:17

标签: c matlab gcc mex

我正在尝试编译a matlab wrapper for libdc1394这是一个火线相机库。 我得到一个奇怪的错误,涉及头文件中的一些内联函数。 我正在使用gcc-4.6在ubuntu 12.04上工作。我已经成功编译了其他mex文件。这个包装器也很难在mac中编译。

/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 个答案:

答案 0 :(得分:4)

Well Simons的建议是正确的。只有抓住我不知道是你不能直接给mex cflags。你必须改变你的mexopts.sh文件。 此外,我不得不删除-ansi标志,因为它与c99相矛盾。

答案 1 :(得分:4)

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

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