How do I correct this Linker error building a mex function? LINK : fatal error LNK1561: entry point must be defined
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to build a NVIDIA CUDA\C++ function supplied to me from a colleague. The linker gives me this error:
>> mex -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\lib\x64" -lcudart -lcuda -llibmex LINKFLAGS="/NODEFAULTLIB:LIBCMT" GpuInterp.cc scandata.c gpulink.o Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved.
C:\Users\Tony\AppData\Local\Temp\mex_vQULwR\GpuInterp.obj C:\Users\Tony\AppData\Local\Temp\mex_vQULwR\scandata.obj gpulink.o LINK : fatal error LNK1561: entry point must be defined
C:\PROGRA~1\MATLAB\R2011B\BIN\MEX.PL: Error: Link of 'GpuInterp.mexw64' failed.
Error using mex (line 206) Unable to complete successfully.
------------------------------------------------ Here are my Compiler and Linker configurations: ------------------------------------------------
>> cc = mex.getCompilerConfigurations()
cc =
mex.CompilerConfiguration
Package: mex
Properties:
Name: 'Microsoft Visual C++ 2008'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '9.0'
Location: 'C:\Program Files (x86)\Microsoft Visual Studio 9.0'
Details: [1x1 mex.CompilerConfigurationDetails]
Methods
>> cc.Details
ans =
mex.CompilerConfigurationDetails
Package: mex
Properties:
CompilerExecutable: 'cl'
CompilerFlags: [1x115 char]
OptimizationFlags: '/O2 /Oy- /DNDEBUG'
DebugFlags: '/Z7'
LinkerExecutable: 'link'
LinkerFlags: [1x317 char]
LinkerOptimizationFlags: ''
LinkerDebugFlags: '/DEBUG /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"'
Methods
>> cc.Details.CompilerFlags
ans =
/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
>> cc.Details.LinkerFlags
ans =
/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
>>
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 16 Dez. 2011
Do you have the required mexFunction entry point defined in one of your source files?
2 Kommentare
Kaustubha Govind
am 19 Dez. 2011
Did you be sure to use the exact function prototype:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[]);
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!