How did you solve this issue?
Mex compiler giving error
4 次查看(过去 30 天)
显示 更早的评论
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');
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!