1

I'm trying to install MatConvNet, as described here. When I run vl_compilenn, I get the following error:

>> vl_compilenn
Building with 'Microsoft Windows SDK 7.1 (C++)'.
MEX completed successfully. % ... repeated many times, then suddenly : 
Error using mex
MEX cannot find library 'gdiplus' specified with the -l option.
 MEX looks for a file with one of the names:
 libgdiplus.lib
 gdiplus.lib
 Please specify the path to this library with the -L option.


Error in vl_compilenn>mex_link (line 456)
mex(mopts{:}) ;

Error in vl_compilenn (line 408)
  mex_link(opts, objs, mex_dir, flags.link) ;

How do I install this library, or do whatever is necessary to get rid of this error?

I'm using MATLAB R2015b on a 64-bit Windows 7. I also succesfully ran mex in some other files, yet I'm quite sure that this library (MatConvNet) does not have a big error, so probably I'm missing some trivial but important file. But I'm not sure what.

Thanks for any help !

Edit

When I tried to copy gdiplus.lib into the proposed location, I get a different error :

...
Building with 'Microsoft Windows SDK 7.1 (C++)'.
MEX completed successfully.
Building with 'Microsoft Windows SDK 7.1 (C++)'.
MEX completed successfully.
Building with 'MinGW64 Compiler (C)'.
Error using mex
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
C:\MATLAB\matconvnet-1.0-beta16\matlab\mex\.build\vl_nnconv.obj:(.text[?vlmxError@@YAXW4_VlmxErrorId@@PEBDZZ]+0x178):
undefined reference to `__security_check_cookie'
C:\MATLAB\matconvnet-1.0-beta16\matlab\mex\.build\vl_nnconv.obj:(.xdata[$unwind$?vlmxError@@YAXW4_VlmxErrorId@@PEBDZZ]+0xc):
undefined reference to `__GSHandlerCheck'
C:\MATLAB\matconvnet-1.0-beta16\matlab\mex\.build\vl_nnconv.obj:(.text[?vlmxNextOption@@YAHQEAPEBUmxArray_tag@@HPEBU_vlmxOption@@PEAHPEAPEBU1@@Z]+0x239):
undefined reference to `__security_check_cookie'
C:\MATLAB\matconvnet-1.0-beta16\matlab\mex\.build\vl_nnconv.obj:(.xdata[$unwind$?vlmxNextOption@@YAHQEAPEBUmxArray_tag@@HPEBU_vlmxOption@@PEAHPEAPEBU1@@Z]+0x10):
undefined reference to `__GSHandlerCheck'
C:\MATLAB\matconvnet-1.0-beta16\matlab\mex\.build\vl_nnconv.obj:(.xdata[$unwind$mexFunction]+0x1c):
... and thousands of lines like this :)    
collect2.exe: error: ld returned 1 exit status


Error in vl_compilenn>mex_link (line 456)
mex(mopts{:}) ;

Error in vl_compilenn (line 408)
  mex_link(opts, objs, mex_dir, flags.link) ;

Edit 2

This, plus choosing Microsoft Windows SDK 7.1 (C) as the mex compiler solves the issue.

jeff
  • 13,055
  • 29
  • 78
  • 136

1 Answers1

1

I had the same exact problem today with MATLAB R2015b. I fixed this error by searching for 'gdiplus.lib' file in my Matlab installation directory("C:\Program Files\MATLAB\R2015b\sys\lcc64\lcc64\lib64") and then copying it to inside the following location inside the MATLAB installation directory ("C:\Program Files\MATLAB\R2015b\extern\lib\win64").

Sohi
  • 114
  • 1
  • 9
  • Thank you so much. But it didn't work for me. Are you sure it's `lib\win64` and not `lib\win64\mingw64`? Anyway, neither of them worked for me. I updated the question with the new error message. Thanks again, – jeff Nov 25 '15 at 23:00
  • I also got the updated error as well. Just try the 'mex -setup C' and choose the Microsoft C compiler from the options. This solved the error for me. – Sohi Nov 26 '15 at 23:38
  • You mean the "Microsoft Windows SDK 7.1 (C)" right? It solves the issue. Thanks again ! – jeff Nov 27 '15 at 09:37