How do I correct this Linker error building a mex function? LINK : fatal error LNK1561: entry point must be defined
조회 수: 9 (최근 30일)
이전 댓글 표시
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
채택된 답변
Kaustubha Govind
2011년 12월 16일
Do you have the required mexFunction entry point defined in one of your source files?
댓글 수: 2
Kaustubha Govind
2011년 12월 19일
Did you be sure to use the exact function prototype:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
const mxArray *prhs[]);
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!