Mex compiler giving error

조회 수: 19 (최근 30일)
John Doe
John Doe 2016년 7월 9일
편집: mimi sam 2017년 5월 13일
Trying to compile this mex file http://escabe.org/joomla/index.php/7-projects/matlab/1-joymex2 with the command
mex('-v','src/joymex2.c','-ISDL/include',['-LSDL/bin/' computer('arch')],'-lSDL');
copyfile(['SDL/bin/' computer('arch') '/SDL.dll'],'.');
Trying to compile any mex file give me an error. Using mingw64 4.9.2 configured with "MATLAB Support for the MinGW-w64 C/C++ Compiler from TDM-GCC". I've put minGW in a folder with no spaces.
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
****************************************************************************
-> Default options filename found in C:\Users\Simon\AppData\Roaming\MathWorks\MATLAB\R2014b
----------------------------------------------------------------
-> Options file = C:\Users\Simon\AppData\Roaming\MathWorks\MATLAB\R2014b\mexopts.bat
MATLAB = C:\PROGRA~1\MATLAB\R2014b
-> COMPILER = gcc
-> Compiler flags:
COMPFLAGS = -c -DMATLAB_MEX_FILE
OPTIMFLAGS = -O3
DEBUGFLAGS = -g
arguments = -ISDL/include
Name switch = -o
-> Pre-linking commands =
-> LINKER = C:\PROGRA~1\MATLAB\R2014b\sys\perl\win32\bin\perl.exe C:\ccc\trunk\linkmex.pl
-> Link directives:
LINKFLAGS = -LC:\Users\Simon\AppData\Roaming\MATHWO~1\MATLAB\R2014b\gnumex
LINKDEBUGFLAGS = -g -Wl,--image-base,0x28000000\n
LINKFLAGSPOST =
Name directive = -o joymex2.mexw64
File link directive =
Lib. link directive =
Rsp file indicator =
-> Resource Compiler = C:\PROGRA~1\MATLAB\R2014b\sys\perl\win32\bin\perl.exe C:\ccc\trunk\rccompile.pl -o mexversion.res
-> Resource Linker =
----------------------------------------------------------------
--> gcc -ISDL/include -c -DMATLAB_MEX_FILE -oC:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj -IC:\PROGRA~1\MATLAB\R2014b\extern\include -IC:\PROGRA~1\MATLAB\R2014b\simulink\include -O3 -DMX_COMPAT_32 src\joymex2.c
--> C:\PROGRA~1\MATLAB\R2014b\sys\perl\win32\bin\perl.exe C:\ccc\trunk\linkmex.pl -o joymex2.mexw64 -LC:\Users\Simon\AppData\Roaming\MATHWO~1\MATLAB\R2014b\gnumex -s C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj SDL\bin\win64\SDL.lib
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x2b): undefined reference to `SDL_JoystickClose'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x3b): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0xc7): undefined reference to `SDL_JoystickOpen'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0xeb): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x103): undefined reference to `SDL_JoystickNumAxes'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x11d): undefined reference to `SDL_JoystickNumButtons'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x135): undefined reference to `SDL_JoystickNumHats'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x13f): undefined reference to `SDL_JoystickName'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x14f): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x167): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x17f): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x197): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x1aa): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x237): undefined reference to `SDL_JoystickUpdate'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x265): undefined reference to `mxCreateStructArray_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x291): undefined reference to `mxCreateNumericMatrix_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x29d): undefined reference to `mxGetData'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x2c0): undefined reference to `SDL_JoystickGetAxis'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x2f7): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x31f): undefined reference to `mxCreateNumericMatrix_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x32b): undefined reference to `mxGetData'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x350): undefined reference to `SDL_JoystickGetButton'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x386): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x3b6): undefined reference to `mxCreateStructArray_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x3e0): undefined reference to `SDL_JoystickGetHat'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x3ef): undefined reference to `mxCreateLogicalScalar'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x407): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x416): undefined reference to `mxCreateLogicalScalar'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x42e): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x444): undefined reference to `mxCreateLogicalScalar'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x45c): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x464): undefined reference to `mxCreateLogicalScalar'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x47f): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x4ad): undefined reference to `mxSetField_700'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x4c8): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x4d9): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x51e): undefined reference to `mxArrayToString'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x541): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x57d): undefined reference to `SDL_JoystickClose'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x58d): undefined reference to `mexPrintf'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x5f8): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x60e): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x619): undefined reference to `mxGetPr'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x65d): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x668): undefined reference to `mxGetPr'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x69b): undefined reference to `SDL_InitSubSystem'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x6a0): undefined reference to `SDL_NumJoysticks'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x1c2): undefined reference to `mexErrMsgTxt'
C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj:joymex2.c:(.text+0x555): undefined reference to `mexAtExit'
collect2.exe: error: ld returned 1 exit status
link command: gcc -shared C:\Users\Simon\AppData\Roaming\MATHWO~1\MATLAB\R2014b\gnumex\mex.def -o joymex2.mexw64 -LC:\Users\Simon\AppData\Roaming\MATHWO~1\MATLAB\R2014b\gnumex -s C:\Users\Simon\AppData\Local\Temp\mex_QlD5Ju\joymex2.obj SDL\bin\win64\SDL.lib -llibmx -llibmex -llibmat
C:\PROGRA~1\MATLAB\R2014B\BIN\MEX.PL: Error: Link of 'joymex2.mexw64' failed.
Unable to complete successfully.
Error in build (line 1)
mex('-v','src/joymex2.c','-ISDL/include',['-LSDL/bin/' computer('arch')],'-lSDL');
  댓글 수: 1
mimi sam
mimi sam 2017년 5월 13일
편집: mimi sam 2017년 5월 13일
How did you solve this issue?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by