How do I correct this Linker error building a mex function? LINK : fatal error LNK1561: entry point must be defined

9 visualizaciones (últimos 30 días)
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"
>>

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 16 de Dic. de 2011
Do you have the required mexFunction entry point defined in one of your source files?
  2 comentarios
Kaustubha Govind
Kaustubha Govind el 19 de Dic. de 2011
Did you be sure to use the exact function prototype:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[]);

Iniciar sesión para comentar.

Más respuestas (1)

Tony
Tony el 16 de Dic. de 2011
Yes I do, in the first compiled file GpuInterp.cc

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by