vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

vl_compilenn Errors Associated with imread_gdiplus/imread_helpers #303

Open stephenjlee opened 8 years ago

stephenjlee commented 8 years ago

Dear MatConvNet community,

I am exploring MatConvNet and trying to compile using MinGW-w64 C/C++. I am getting the following errors when I run, "vl_compilenn('verbose', 2)"

Any suggestions would be greatly appreciated!

Thank you!

capture

...

capture2

FelixGruen commented 8 years ago

I'm having the same problem and I'm stuck. Google didn't help and I tried four different versions of MinGW: The standard one (4.9.2), which comes as the MatLab add on, and the same, the latest (5.2.0) and an older version by using the mexopts.bat. Always the same error. I also tried using the Visual Studio 2013 compiler, but it seems mex needs MinGW.

I'm running Matlab 2015b on Windows 10 64-Bit.

I really need this library, so any help would be greatly appreciated!

[...]

vl_compilenn: MEX CC: -outdir C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\mex\.build\bits\impl C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp -c -v -DNDEBUG -D__SSSE3__ -largeArrayDims
-> Default options filename found in C:\Users\thisUser\AppData\Roaming\MathWorks\MATLAB\R2015b 
---------------------------------------------------------------- 
->    Options file           = C:\Users\thisUser\AppData\Roaming\MathWorks\MATLAB\R2015b\mexopts.bat 
      MATLAB                 =  
->    COMPILER               = g++ 
->    Compiler flags: 
         COMPFLAGS           = -c -I"C:\Program Files\MATLAB\R2015b\extern\include" -DMATLAB_MEX_FILE 
         OPTIMFLAGS          = -O3 -funroll-loops -DNDEBUG 
         DEBUGFLAGS          = -g 
         arguments           =  -DNDEBUG -D__SSSE3__ 
         Name switch         = -o 
->    Pre-linking commands   = echo.>C:\Users\thisUser\AppData\Local\Temp\mexstaticlibs 
->    LINKER                 = g++ 
->    Link directives: 
         LINKFLAGS           = -shared -static-libstdc++ -static-libgcc -L"C:\Program Files\MATLAB\R2015b\bin\win64" -L"C:\Program Files\MATLAB\R2015b\extern\lib\win64\microsoft" -lmex -lmx -leng -lmat -lmwlapack -lmwblas 
         LINKDEBUGFLAGS      =  
         LINKFLAGSPOST       = @C:\Users\thisUser\AppData\Local\Temp\mexstaticlibs 
         Name directive      = -o "C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\mex\.build\bits\impl\imread_gdiplus.mexw64" 
         File link directive =  
         Lib. link directive =  
         Rsp file indicator  =  
->    Resource Compiler      =   
->    Resource Linker        =   
---------------------------------------------------------------- 

--> g++  -DNDEBUG -D__SSSE3__ -c -I"C:\Program Files\MATLAB\R2015b\extern\include" -DMATLAB_MEX_FILE -oC:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\mex\.build\bits\impl\imread_gdiplus.obj -Iextern\include -O3 -funroll-loops -DNDEBUG C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp 

In file included from C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_helpers.hpp:17:0, 
                 from C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:14: 
C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function '__m128i _mm_hadd_epi16(__m128i, __m128i)': 
C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:42:70: error: '__builtin_ia32_phaddw128' was not declared in this scope 
   return (__m128i) __builtin_ia32_phaddw128 ((__v8hi)__X, (__v8hi)__Y); 
                                                                      ^ 
C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function '__m128i _mm_hadd_epi32(__m128i, __m128i)': 
C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:48:70: error: '__builtin_ia32_phaddd128' was not declared in this scope 
   return (__m128i) __builtin_ia32_phaddd128 ((__v4si)__X, (__v4si)__Y); 
                                                                      ^ 
[...]

C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:151:1: error: jump to label 'done' [-fpermissive] 
 done: 
 ^ 
C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:85:10: error:   from here [-fpermissive] 
     goto done ; 
          ^
C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:99:24: error:   crosses initialization of 'Gdiplus::PixelFormat targetPixelFormat' 
   Gdiplus::PixelFormat targetPixelFormat = PixelFormat32bppRGB ; 
                        ^ 

  C:\PROGRA~1\MATLAB\R2015B\BIN\MEX.PL: Error: Compile of 'C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp' failed. 

Unable to complete successfully.

Error in vl_compilenn>mex_compile (line 438)
mex(mopts{:}) ;

Error in vl_compilenn (line 400)
    mex_compile(opts, srcs{i}, toobj(bld_dir,srcs{i}), flags.mexcc) ;

Error in test (line 3)
vl_compilenn('verbose', 2)
vedaldi commented 8 years ago

Hi, I never copied using MinGW so I am not sure how well that would work.

However, this is clearly a blunder on my part (goto statements cannot cross variable initializations) that is tolerated by Visual C++. (we sparingly use goto to exit a function when errors are encountered).

You could try adding the “-fpermissive” option to the compile flag and see if that works. I would be interested to know if MinGW works.

Having said that, MEX definitely works with Visual Studio (you might have problems with some free of charge 32 bit version of the latter however).

On 27 Nov 2015, at 16:31, Felix Grün notifications@github.com wrote:

I'm having the same problem and I'm stuck. Google didn't help and I tried four different versions of MinGW: The standard one (4.9.2), which comes as the MatLab add on, and the same, the latest (5.2.0) and an older version by using the mexopts.bat http://www.damtp.cam.ac.uk/research/afha/bogdan/#code. Always the same error. I also tried using the Visual Studio 2013 compiler, but it seems mex needs MinGW.

I'm running Matlab 2015b on Windows 10 64-Bit.

I really need this library, so any help would be greatly appreciated!

[...]

vl_compilenn: MEX CC: -outdir C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\mex.build\bits\impl C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp -c -v -DNDEBUG -DSSSE3 -largeArrayDims

-> Default options filename found in C:\Users\thisUser\AppData\Roaming\MathWorks\MATLAB\R2015b

-> Options file = C:\Users\thisUser\AppData\Roaming\MathWorks\MATLAB\R2015b\mexopts.bat MATLAB =
-> COMPILER = g++ -> Compiler flags: COMPFLAGS = -c -I"C:\Program Files\MATLAB\R2015b\extern\include" -DMATLAB_MEX_FILE OPTIMFLAGS = -O3 -funroll-loops -DNDEBUG DEBUGFLAGS = -g arguments = -DNDEBUG -DSSSE3 Name switch = -o -> Pre-linking commands = echo.>C:\Users\thisUser\AppData\Local\Temp\mexstaticlibs -> LINKER = g++ -> Link directives: LINKFLAGS = -shared -static-libstdc++ -static-libgcc -L"C:\Program Files\MATLAB\R2015b\bin\win64" -L"C:\Program Files\MATLAB\R2015b\extern\lib\win64\microsoft" -lmex -lmx -leng -lmat -lmwlapack -lmwblas LINKDEBUGFLAGS =
LINKFLAGSPOST = @C:\Users\thisUser\AppData\Local\Temp\mexstaticlibs Name directive = -o "C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\mex.build\bits\impl\imread_gdiplus.mexw64" File link directive =
Lib. link directive =
Rsp file indicator =
-> Resource Compiler =

-> Resource Linker =

--> g++ -DNDEBUG -DSSSE3 -c -I"C:\Program Files\MATLAB\R2015b\extern\include" -DMATLAB_MEX_FILE -oC:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\mex.build\bits\impl\imread_gdiplus.obj -Iextern\include -O3 -funroll-loops -DNDEBUG C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp

In file included from C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_helpers.hpp:17:0, from C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:14: C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hadd_epi16(m128i, m128i)': C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:42:70: error: 'builtin_ia32_phaddw128' was not declared in this scope return (m128i) builtin_ia32_phaddw128 ((v8hi)X, (v8hi)Y); ^ C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hadd_epi32(m128i, m128i)': C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:48:70: error: 'builtin_ia32_phaddd128' was not declared in this scope return (m128i) builtin_ia32_phaddd128 ((v4si)X, (v4si)Y); ^ [...]

C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:151:1: error: jump to label 'done' [-fpermissive] done: ^ C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:85:10: error: from here [-fpermissive] goto done ; ^ C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp:99:24: error: crosses initialization of 'Gdiplus::PixelFormat targetPixelFormat' Gdiplus::PixelFormat targetPixelFormat = PixelFormat32bppRGB ; ^

C:\PROGRA~1\MATLAB\R2015B\BIN\MEX.PL: Error: Compile of 'C:\Users\thisUser\Documents\MATLAB\matconvnet-master\matlab\src\bits\impl\imread_gdiplus.cpp' failed.

Unable to complete successfully.

Error in vl_compilenn>mex_compile (line 438) mex(mopts{:}) ;

Error in vl_compilenn (line 400) mex_compile(opts, srcs{i}, toobj(bld_dir,srcs{i}), flags.mexcc) ;

Error in test (line 3) vl_compilenn('verbose', 2) — Reply to this email directly or view it on GitHub https://github.com/vlfeat/matconvnet/issues/303#issuecomment-160171119.

rajansawhney commented 8 years ago

I'm having the same problem. Any solution yet? --> Building with 'MinGW64 Compiler (C++)'. Error using mex

Error in vl_compilenn>mex_compile (line 438) mex(mopts{:}) ;

Error in vl_compilenn (line 400) mex_compile(opts, srcs{i}, toobj(bld_dir,srcs{i}), flags.mexcc) ;

dbparedes commented 8 years ago

I have exactly the same problem. I don't know how to add "-fpermissive" flag. Just in case, I'm trying to install on windows. Any idea? Thanks in advance.

lenck commented 8 years ago

Hi, the easiest would be really to compile it with the Visual Studio (for example any of the community editions which are for free), which should work... With MinGW it's a bit complicated because CUDA does not support it, it usually does not go with libjpeg and the GDIPlus library which we use for vl_imreadjpeg on Windows is distributed with VisualStudio. So I'm not sure if it makes sense to support it. Another option would be to compile it with: vl_compilenn('EnableImreadJpeg', false) if the error is only in the vl_imreadjpeg.

rmardiko commented 8 years ago

Consider using Microsoft Windows SDK compiler (Free). It works for me.

dbparedes commented 8 years ago

You're right. Thank you! I have already solved this problem :D

yohanjohn commented 8 years ago

Hi! I'm new to this kind of installation. What does it mean to use Microsoft Windows SDK compiler (or Visual Studio)? What are the steps involved in using those softwares?

rmardiko commented 8 years ago

Windows SDK includes C/C++ compiler that is compatible with Matlab MEX. You have to download it from https://www.microsoft.com/en-us/download/details.aspx?id=8279 and install it on your computer. After the installation Matlab should recognize the compiler and you can run matlab command mex -setup to configure.

However, it seems to me the Windows SDK C/C++ cannot compile the GPU enabled compilation which is fine in my case.

yohanjohn commented 8 years ago

Thanks! I figured it out.

whigy commented 8 years ago

Hi! I met a problem that when compiling vl_complienn, ''Microsoft Complier Driver C/C++ stopped working''. Is there anyone met the same problem with me and anyone has any idea about how to solve it?

vedaldi commented 8 years ago

Hi, thanks for the feedback. We had to modify heavily the build script to implement a work-around for a bug in MATLAB 2016a, but it is not unlikely that this broke something else. Could you please report your output?

On 3 May 2016, at 00:03, whigy notifications@github.com wrote:

Hi! I met a problem that when compiling vl_complienn, ''Microsoft Complier Driver C/C++ stopped working''. Is there anyone met the same problem with me and anyone has any idea about how to solve it?

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/vlfeat/matconvnet/issues/303#issuecomment-216390588

humamaki commented 8 years ago

Hi Vedaldi,

I'm having the same problem when following the steps in the quick start guide.

I'm using Windows 10 64 bit and MATLAB R2016a (9.0.0.341360) 64-bit Fed/11/2016.

I'm getting the following error when I build with MinGW64

Building with 'MinGW64 Compiler (C++)'.
C:\MATLAB\SupportPackages\R2016a\MW_MinGW_4_9\bin\g++ -c -DNDEBUG  -DENABLE_DOUBLE  -D__SSSE3__   -m64 -DMATLAB_MEX_FILE  -I"C:\Program Files\MATLAB\R2016a/extern/include" -I"C:\Program Files\MATLAB\R2016a/simulink/include" -fexceptions -fno-omit-frame-pointer  -O -DNDEBUG  C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\src\bits\impl\imread_gdiplus.cpp -o C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\imread_gdiplus.obj
Error using mex
In file included from C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\src\bits\impl\imread_helpers.hpp:18:0,
                 from C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\src\bits\impl\imread_gdiplus.cpp:14:
C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function '__m128i
_mm_hadd_epi16(__m128i, __m128i)':
C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:42:70: error:
'__builtin_ia32_phaddw128' was not declared in this scope
   return (__m128i) __builtin_ia32_phaddw128 ((__v8hi)__X, (__v8hi)__Y);                                                                   ^
.
.
.

Error in vl_compilenn>mex_compile (line 510)
mex(mopts{:}) ;

Error in vl_compilenn (line 471)
    mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;

Error in run (line 96)
evalin('caller', [script ';']);

And the following error when I build with Microsoft Visual C++ 2015 Professional

Building with 'MinGW64 Compiler (C)'.
C:\MATLAB\SupportPackages\R2016a\MW_MinGW_4_9\bin\gcc -m64 -Wl,--no-undefined  -shared -s -Wl,"C:\Program Files\MATLAB\R2016a/extern/lib/win64/mingw64/mexFunction.def" C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\vl_nnconv.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\data.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\datamex.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnconv.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnfullyconnected.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnsubsample.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnpooling.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnnormalize.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnbnorm.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnbias.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\nnbilinearsampler.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\im2row_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\subsample_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\copy_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\pooling_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\normalize_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\bnorm_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\tinythread.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\bilinearsampler_cpu.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\imread.obj C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\.build\bits\impl\imread_gdiplus.obj  -llibmwblas  -L"C:\Program Files\MATLAB\R2016a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas gdiplus.lib -o C:\Users\humam\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex\vl_nnconv.mexw64
Error using mex
gcc: error: gdiplus.lib: No such file or directory

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

Error in vl_compilenn (line 479)
  mex_link(opts, objs, mex_dir, flags.mexlink) ;

Error in run (line 96)
evalin('caller', [script ';']);

Thank you in advance.

mm5223 commented 8 years ago

I have tried to download Windows SDK includes C/C++ compiler and run matlab command mex -setup to configure. It still showed error when I run "vl_compilenn"

Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. Error using vl_compilenn>mex_compile (line 438) In file included from C:\Users\Amir\Documents\MATLAB\matconvnet-1.0-beta13\matlab\src\bits\impl\imread_helpers.hpp:17:0, from C:\Users\Amir\Documents\MATLAB\matconvnet-1.0-beta13\matlab\src\bits\impl\imread_gdiplus.cpp:14: C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hadd_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:42:70: error: 'builtin_ia32_phaddw128' was not declared in this scope return (m128i) builtin_ia32_phaddw128 ((v8hi)X, (v8hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hadd_epi32(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:48:70: error: 'builtin_ia32_phaddd128' was not declared in this scope return (m128i) builtin_ia32_phaddd128 ((v4si)X, (v4si)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hadds_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:54:71: error: 'builtin_ia32_phaddsw128' was not declared in this scope return (m128i) builtin_ia32_phaddsw128 ((v8hi)X, (v8hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_hadd_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:60:65: error: 'builtin_ia32_phaddw' was not declared in this scope return (m64) builtin_ia32_phaddw ((v4hi)X, (v4hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_hadd_pi32(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:66:65: error: 'builtin_ia32_phaddd' was not declared in this scope return (m64) builtin_ia32_phaddd ((v2si)X, (v2si)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_hadds_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:72:66: error: 'builtin_ia32_phaddsw' was not declared in this scope return (m64) builtin_ia32_phaddsw ((v4hi)X, (v4hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hsub_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:78:70: error: 'builtin_ia32_phsubw128' was not declared in this scope return (m128i) builtin_ia32_phsubw128 ((v8hi)X, (v8hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hsub_epi32(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:84:70: error: 'builtin_ia32_phsubd128' was not declared in this scope return (m128i) builtin_ia32_phsubd128 ((v4si)X, (v4si)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_hsubs_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:90:71: error: 'builtin_ia32_phsubsw128' was not declared in this scope return (m128i) builtin_ia32_phsubsw128 ((v8hi)X, (v8hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_hsub_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:96:65: error: 'builtin_ia32_phsubw' was not declared in this scope return (m64) builtin_ia32_phsubw ((v4hi)X, (v4hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_hsub_pi32(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:102:65: error: 'builtin_ia32_phsubd' was not declared in this scope return (m64) builtin_ia32_phsubd ((v2si)X, (v2si)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_hsubs_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:108:66: error: 'builtin_ia32_phsubsw' was not declared in this scope return (m64) builtin_ia32_phsubsw ((v4hi)X, (v4hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_maddubs_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:114:75: error: 'builtin_ia32_pmaddubsw128' was not declared in this scope return (m128i) builtin_ia32_pmaddubsw128 ((v16qi)X, (v16qi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_maddubs_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:120:68: error: 'builtin_ia32_pmaddubsw' was not declared in this scope return (m64) builtin_ia32_pmaddubsw ((v8qi)X, (v8qi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_mulhrs_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:126:72: error: 'builtin_ia32_pmulhrsw128' was not declared in this scope return (m128i) builtin_ia32_pmulhrsw128 ((v8hi)X, (v8hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_mulhrs_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:132:67: error: 'builtin_ia32_pmulhrsw' was not declared in this scope return (m64) builtin_ia32_pmulhrsw ((v4hi)X, (v4hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_shuffle_epi8(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:138:72: error: 'builtin_ia32_pshufb128' was not declared in this scope return (m128i) builtin_ia32_pshufb128 ((v16qi)X, (v16qi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_shuffle_pi8(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:144:65: error: 'builtin_ia32_pshufb' was not declared in this scope return (m64) builtin_ia32_pshufb ((v8qi)X, (v8qi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_sign_epi8(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:150:72: error: 'builtin_ia32_psignb128' was not declared in this scope return (m128i) builtin_ia32_psignb128 ((v16qi)X, (v16qi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_sign_epi16(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:156:70: error: 'builtin_ia32_psignw128' was not declared in this scope return (m128i) builtin_ia32_psignw128 ((v8hi)X, (v8hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_sign_epi32(m128i, m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:162:70: error: 'builtin_ia32_psignd128' was not declared in this scope return (m128i) builtin_ia32_psignd128 ((v4si)X, (v4si)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_sign_pi8(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:168:65: error: 'builtin_ia32_psignb' was not declared in this scope return (m64) builtin_ia32_psignb ((v8qi)X, (v8qi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_sign_pi16(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:174:65: error: 'builtin_ia32_psignw' was not declared in this scope return (m64) builtin_ia32_psignw ((v4hi)X, (v4hi)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_sign_pi32(m64, m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:180:65: error: 'builtin_ia32_psignd' was not declared in this scope return (m64) builtin_ia32_psignd ((v2si)X, (v2si)Y); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_alignr_epi8(m128i, m128i, int)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:188:32: error: 'builtin_ia32_palignr128' was not declared in this scope (v2di)Y, N * 8); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function '__m64 _mm_alignr_pi8(m64, m64, int)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:195:27: error: 'builtin_ia32_palignr' was not declared in this scope (v1di)Y, N * 8); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_abs_epi8(m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:211:57: error: 'builtin_ia32_pabsb128' was not declared in this scope return (m128i) builtin_ia32_pabsb128 ((v16qi)X); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm128i _mm_abs_epi16(m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:217:56: error: 'builtin_ia32_pabsw128' was not declared in this scope return (m128i) builtin_ia32_pabsw128 ((v8hi)X); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function '__m128i _mm_abs_epi32(m128i)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:223:56: error: 'builtin_ia32_pabsd128' was not declared in this scope return (m128i) builtin_ia32_pabsd128 ((v4si)X); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_abs_pi8(m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:229:51: error: 'builtin_ia32_pabsb' was not declared in this scope return (m64) builtin_ia32_pabsb ((v8qi)X); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function 'm64 _mm_abs_pi16(m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:235:51: error: 'builtin_ia32_pabsw' was not declared in this scope return (m64) builtin_ia32_pabsw ((v4hi)X); ^ C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h: In function '__m64 _mm_abs_pi32(m64)': C:/MATLAB/SupportPackages/R2016a/MW_MinGW_4_9/lib/gcc/x86_64-w64-mingw32/4.9.2/include/tmmintrin.h:241:51: error: 'builtin_ia32_pabsd' was not declared in this scope return (m64) builtin_ia32_pabsd ((v2si)__X); ^ C:\Users\Amir\Documents\MATLAB\matconvnet-1.0-beta13\matlab\src\bits\impl\imreadgdiplus.cpp: In member function 'vl::Image vl::ImageReader::Impl::read(const char, float_)': C:\Users\Amir\Documents\MATLAB\matconvnet-1.0-beta13\matlab\src\bits\impl\imread_gdiplus.cpp:91:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^ C:\Users\Amir\Documents\MATLAB\matconvnet-1.0-beta13\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::Image vl::ImageReader::Impl::readDimensions(const char*)': C:\Users\Amir\Documents\MATLAB\matconvnet-1.0-beta13\matlab\src\bits\impl\imread_gdiplus.cpp:149:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^ Error in vl_compilenn (line 391) parfor i = 1:numel(horzcat(lib_src, mex_src))

Can any one help me?

brihati commented 8 years ago

@vedaldi I am getting the below error while compiling Error using mex C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imreadgdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readPixels(float, const char_)': C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp:77:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^ C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp:144:1: error: jump to label 'done' [-fpermissive] done: ^ C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp:83:10: error: from here [-fpermissive] goto done ; ^ C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp:92:24: error: crosses initialization of 'Gdiplus::PixelFormat targetPixelFormat' Gdiplus::PixelFormat targetPixelFormat = PixelFormat32bppRGB ; ^ C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp:90:9: error: crosses initialization of 'vl::Image image' Image image(shape, memory); ^ C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readShape(vl::ImageShape&, const char*)': C:\Users\Brihati.Jain\Documents\MathConvNet\matconvnet-1.0-beta21\matlab\src\bits\impl\imread_gdiplus.cpp:157:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^

Error in vl_compilenn>mex_compile (line 524) mex(mopts{:}) ;

Error in vl_compilenn (line 485) mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;

Can you please help me out.I am using R2016b version of MATLAB and VS for compiling in C/C++. I tried both C and C++ using mex -setup but didnt work.I am new to ConvNets kindly help.

Masoud-Ghodrati commented 8 years ago

Hi all It seems many people have this problem :(, I also have this error:

Error using mex gcc: error: gdiplus.lib: No such file or directory

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

Error in vl_compilenn (line 498) mex_link(opts, objs, mex_dir, flags.mexlink) ;

Error in run (line 96) evalin('caller', [script ';']);

Error in CNN_Run (line 8) run matlab/vl_compilenn;

has anyone found a solution? I've changed the MathConvNet release. same thing happens.

wennyICT commented 7 years ago

I am stuck by the exactly same problem when trying to compile MatConvNet by using Visual Studio 2010, Matlab R2012b on Windows 7 64-Bit.

Since I have already found Microsoft Windows SDK v6.0A installed in my PC, do I need install Windows SDK 7.1 to solve the problem?

Can any one help me? Thank you in advance.

Masoud-Ghodrati commented 7 years ago

try this, you might need to set your compiler:

% Install and compile MatConvNet (needed once). untar('http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta23.tar.gz') ; cd matconvnet-1.0-beta23 mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvc2015.xml' C mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvcpp2015.xml' C++

... rest of your code

let me know if it works for you

Masoud-Ghodrati commented 7 years ago

try this, you might need to set your compiler:

% Install and compile MatConvNet (needed once). untar(' http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta23.tar.gz') ; cd matconvnet-1.0-beta23 mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvc2015.xml' C mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvcpp2015.xml' C++

... rest of your code

let me know if it works for you

On Mon, Oct 31, 2016 at 11:18 PM, wennyICT notifications@github.com wrote:

I am stuck by the exactly same problem when trying to compile MatConvNet by using Visual Studio 2010, Matlab R2012b on Windows 7 64-Bit.

Since I have already found Microsoft Windows SDK v6.0A installed in my PC, do I need install Windows SDK 7.1 to solve the problem?

Can any one help me? Thank you in advance.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vlfeat/matconvnet/issues/303#issuecomment-257279414, or mute the thread https://github.com/notifications/unsubscribe-auth/AV0TKdj58VbfgFb-ul5DzInLWU1J0EYtks5q5dyCgaJpZM4GYXaQ .


Masoud Ghodrati,

PhD Student, Department of Physiology, Monash University, Melbourne, Australia.

E-mails: masoud.ghodrati@monash.edu Web pages (Personal) : https://sites.google.com/site/masoudghodrati1985/


zwm0426 commented 7 years ago

I am using Windows 10, MATLAB 2016b and MS Visual Studio 2015 Community. And I faced the problem like this: (for different version of MatConvNet, line number are vary. )

error vl_compilenn>mex_compile (line 525) mex(mopts{:}) ;

error vl_compilenn (line 486) mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;

error run (line 96) evalin('caller', [script ';']);

error convnet (line 4) run matlab/vl_compilenn ;

I tried beta 23 (latest) to beta 20, it still happened. And I tried the method by @masi96 . It works, and I received a bell pepper image figure after successfully compiled and downloaded pre-trained network of ImageNet.

Thanks, @masi96 !

vismayaps commented 7 years ago

I am using Windows 10, MATLAB 2016b and MS Visual Studio 14.0, and when I tried installing MatConvNet on my system the compilation step gives error, this is the link I used for installation http://www.vlfeat.org/matconvnet/install/. vl_compilenn gives the following error: vl_compilenn: CUDA: MEX config file: 'C:\MATLAB\R2016b\toolbox\distcomp\gpu\extern\src\mex\win64\mex_CUDA_win64.xml' Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. Building with 'MinGW64 Compiler (C++)'. Error using mex C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readPixels(float, const char)': C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp:102:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^ C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readShape(vl::ImageShape&, const char*)': C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp:185:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^

Error in vl_compilenn>mex_compile (line 529) mex(mopts{:}) ;

Error in vl_compilenn (line 490) mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;

I tried "vl_compilenn('verbose', 1)" this also, the given error is the following;

vl_compilenn: CUDA: MEX config file: 'C:\MATLAB\R2016b\toolbox\distcomp\gpu\extern\src\mex\win64\mex_CUDA_win64.xml' vl_compilenn: Compiler and linker configurations vl_compilenn: intermediate build products directory: C:\matconvnet-1.0-beta23\matlab\mex.build vl_compilenn: MEX files: C:\matconvnet-1.0-beta23\matlab\mex/ vl_compilenn: MEX options [CC CPU]: -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS vl_compilenn: MEX options [LINK]: -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -lmwblas -largeArrayDims LDFLAGS=$LDFLAGS LINKLIBS=gdiplus.lib $LINKLIBS vl_compilenn: Reading images vl_compilenn: vl_imreadjpeg enabled vl_compilenn: image library: gdiplus vl_compilenn: image library compile flags: vl_compilenn: image library link flags: gdiplus.lib vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\data.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\datamex.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnconv.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnfullyconnected.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnsubsample.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnpooling.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnnormalize.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnbnorm.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnbias.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnbilinearsampler.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\nnroipooling.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\im2row_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\subsample_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\copy_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\pooling_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\normalize_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\bnorm_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\tinythread.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\bilinearsampler_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\roipooling_cpu.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits C:\matconvnet-1.0-beta23\matlab\src\bits\imread.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. MEX completed successfully. vl_compilenn: MEX CC: -outdir C:\matconvnet-1.0-beta23\matlab\mex.build\bits\impl C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp -c -DNDEBUG -DENABLE_DOUBLE -DSSSE3 -largeArrayDims CXXFLAGS=$CXXFLAGS CXXOPTIMFLAGS=$CXXOPTIMFLAGS Building with 'MinGW64 Compiler (C++)'. Error using mex C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readPixels(float, const char)': C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp:102:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^ C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readShape(vl::ImageShape&, const char*)': C:\matconvnet-1.0-beta23\matlab\src\bits\impl\imread_gdiplus.cpp:185:83: error: 'mbstowcs_s' was not declared in this scope mbstowcs_s(&n, filenamew, sizeof(filenamew)/sizeof(wchar_t), filename, _TRUNCATE); ^

Error in vl_compilenn>mex_compile (line 529) mex(mopts{:}) ;

Error in vl_compilenn (line 490) mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;

I have installed MING-64 compiler separately and tried the above mentioned methods also and it is still giving error like this. Any help would be greatly appreciated !! Thank you in advance !

gklosowski commented 7 years ago

Do the following steps:

  1. Install Visual Studio 2013 (https://www.visualstudio.com/en-us/news/releasenotes/vs2013-community-vs)
  2. Update Windows 10 path with "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64"
  3. run Matlab R2016b
  4. the rest is written below (important commands are bolded)

>> mex -setup

MEX configured to use 'Microsoft Visual C++ 2013 Professional (C)' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.

To choose a different C compiler, select one from the following: MinGW64 Compiler (C) mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\mingw64.xml' C Microsoft Visual C++ 2013 Professional (C) mex -setup:C:\Users\gklosowski\AppData\Roaming\MathWorks\MATLAB\R2016b\mex_C_win64.xml C

To choose a different language, select one from the following: mex -setup C++ mex -setup FORTRAN IdleTimeout has been reached. Parallel pool using the 'local' profile is shutting down. Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers. MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.

To choose a different C++ compiler, select one from the following: MinGW64 Compiler (C++) mex -setup:C:\Users\gklosowski\AppData\Roaming\MathWorks\MATLAB\R2016b\mex_C++_win64.xml C++ Microsoft Visual C++ 2013 Professional mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvcpp2013.xml' C++

>> mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvcpp2013.xml' C++

MEX configured to use 'Microsoft Visual C++ 2013 Professional' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html. >> vl_compilenn

vl_compilenn: CUDA: MEX config file: 'C:\Program Files\MATLAB\R2016b\toolbox\distcomp\gpu\extern\src\mex\win64\mex_CUDA_win64.xml' Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully. Building with 'Microsoft Visual C++ 2013 Professional (C)'. MEX completed successfully.

YerongLi commented 7 years ago

The problem comes from the compiler for c++, "MinGW64 Compiler (C++)" does not work. One can use "Microsoft Visual C++" instead. "Microsoft Visual C++ 2015 Professional " definitely works. Type

mex.getCompilerConfigurations('C','Selected')
mex.getCompilerConfigurations('C++','Selected') 

to see the compiler options. mex -setup c++ will let you know what options you have For instance, (Microsoft Visual C++ 2015) mex -setup:'C:\Program Files\MATLAB\R2016a\bin\win64\mexopts\msvcpp2015.xml' C++

Four-clover commented 6 years ago

Configure: Win 10; VS 2015 community; matconvnet-1.0-beta25 I solved this problem as following way: before compile, set matlab to use the same compiler. mex -setup:YourC++Path C++ mex -setup:YourCPath C

In my test , I used "Microsoft Visual C++ 2015 Professional" and "Microsoft Visual C++ 2015 Professional (C)" to compile. And the YourC++Path is "C:\Users\Cun\AppData\Roaming\MathWorks\MATLAB\R2016a\mex_C++_win64.xml" and YourGCPath is "D:\Matlab2016a\bin\win64\mexopts\mingw64.xml".

You can find this path by using command "mex -setup C++" and " mex -setup C"

Hopeful can help u.

[1]http://www.vlfeat.org/matconvnet/install/

CodePrt commented 6 years ago

I have the same problem, how to fix it

`Error using mex In file included from D:\Software\matconvnet-1.0-beta25\matlab\src\bits\impl\imread_helpers.hpp:19, from D:\Software\matconvnet-1.0-beta25\matlab\src\bits\impl\imread_gdiplus.cpp:14: D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_hadd_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:42:20: error: 'builtin_ia32_phaddw128' was not declared in this scope return (m128i) builtin_ia32_phaddw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:42:20: note: suggested alternative: 'builtin_ia32_paddw128' return (m128i) builtin_ia32_phaddw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~ builtin_ia32_paddw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_hadd_epi32(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:48:20: error: 'builtin_ia32_phaddd128' was not declared in this scope return (m128i) builtin_ia32_phaddd128 ((v4si)X, (v4si)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:48:20: note: suggested alternative: 'builtin_ia32_paddd128' return (m128i) builtin_ia32_phaddd128 ((v4si)X, (v4si)Y); ^~~~~~~~ builtin_ia32_paddd128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_hadds_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:54:20: error: 'builtin_ia32_phaddsw128' was not declared in this scope return (m128i) builtin_ia32_phaddsw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:54:20: note: suggested alternative: 'builtin_ia32_paddsw128' return (m128i) builtin_ia32_phaddsw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~~ builtin_ia32_paddsw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_hsub_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:78:20: error: 'builtin_ia32_phsubw128' was not declared in this scope return (m128i) builtin_ia32_phsubw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:78:20: note: suggested alternative: 'builtin_ia32_psubw128' return (m128i) builtin_ia32_phsubw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~ builtin_ia32_psubw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_hsub_epi32(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:84:20: error: 'builtin_ia32_phsubd128' was not declared in this scope return (m128i) builtin_ia32_phsubd128 ((v4si)X, (v4si)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:84:20: note: suggested alternative: 'builtin_ia32_psubd128' return (m128i) builtin_ia32_phsubd128 ((v4si)X, (v4si)Y); ^~~~~~~~ builtin_ia32_psubd128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_hsubs_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:90:20: error: 'builtin_ia32_phsubsw128' was not declared in this scope return (m128i) builtin_ia32_phsubsw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:90:20: note: suggested alternative: 'builtin_ia32_psubsw128' return (m128i) builtin_ia32_phsubsw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~~ builtin_ia32_psubsw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_maddubs_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:114:20: error: 'builtin_ia32_pmaddubsw128' was not declared in this scope return (m128i) builtin_ia32_pmaddubsw128 ((v16qi)X, (v16qi)Y); ^~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:114:20: note: suggested alternative: 'builtin_ia32_paddusw128' return (m128i) builtin_ia32_pmaddubsw128 ((v16qi)X, (v16qi)Y); ^~~~~~~ builtin_ia32_paddusw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_mulhrs_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:126:20: error: 'builtin_ia32_pmulhrsw128' was not declared in this scope return (m128i) builtin_ia32_pmulhrsw128 ((v8hi)X, (v8hi)Y); ^~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:126:20: note: suggested alternative: 'builtin_ia32_pmulhuw128' return (m128i) builtin_ia32_pmulhrsw128 ((v8hi)X, (v8hi)Y); ^~~~~~ builtin_ia32_pmulhuw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_shuffle_epi8(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:138:20: error: 'builtin_ia32_pshufb128' was not declared in this scope return (m128i) builtin_ia32_pshufb128 ((v16qi)X, (v16qi)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:138:20: note: suggested alternative: 'builtin_ia32_psubb128' return (m128i) builtin_ia32_pshufb128 ((v16qi)X, (v16qi)Y); ^~~~~~~~ builtin_ia32_psubb128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_sign_epi8(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:150:20: error: 'builtin_ia32_psignb128' was not declared in this scope return (m128i) builtin_ia32_psignb128 ((v16qi)X, (v16qi)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:150:20: note: suggested alternative: 'builtin_ia32_psignb' return (m128i) builtin_ia32_psignb128 ((v16qi)X, (v16qi)Y); ^~~~~~~~ builtin_ia32_psignb D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_sign_epi16(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:156:20: error: 'builtin_ia32_psignw128' was not declared in this scope return (m128i) builtin_ia32_psignw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:156:20: note: suggested alternative: 'builtin_ia32_psignw' return (m128i) builtin_ia32_psignw128 ((v8hi)X, (v8hi)Y); ^~~~~~~~ builtin_ia32_psignw D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_sign_epi32(m128i, m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:162:20: error: 'builtin_ia32_psignd128' was not declared in this scope return (m128i) builtin_ia32_psignd128 ((v4si)X, (v4si)Y); ^~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:162:20: note: suggested alternative: 'builtin_ia32_psignd' return (m128i) builtin_ia32_psignd128 ((v4si)X, (v4si)Y); ^~~~~~~~ builtin_ia32_psignd D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_alignr_epi8(m128i, m128i, int)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:187:20: error: 'builtin_ia32_palignr128' was not declared in this scope return (m128i) builtin_ia32_palignr128 ((v2di)X, ^~~~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:187:20: note: suggested alternative: 'builtin_ia32_palignr' return (m128i) builtin_ia32_palignr128 ((v2di)X, ^~~~~~~~~ builtin_ia32_palignr D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_abs_epi8(__m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:211:20: error: 'builtin_ia32_pabsb128' was not declared in this scope return (m128i) builtin_ia32_pabsb128 ((v16qi)X); ^~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:211:20: note: suggested alternative: 'builtin_ia32_pavgb128' return (m128i) builtin_ia32_pabsb128 ((v16qi)X); ^~~~~~~ builtin_ia32_pavgb128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_abs_epi16(__m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:217:20: error: 'builtin_ia32_pabsw128' was not declared in this scope return (m128i) builtin_ia32_pabsw128 ((v8hi)X); ^~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:217:20: note: suggested alternative: 'builtin_ia32_pmaxsw128' return (m128i) builtin_ia32_pabsw128 ((v8hi)X); ^~~~~~~ builtin_ia32_pmaxsw128 D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h: In function 'm128i _mm_abs_epi32(__m128i)': D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:223:20: error: 'builtin_ia32_pabsd128' was not declared in this scope return (m128i) builtin_ia32_pabsd128 ((v4si)X); ^~~~~~~ D:/Software/MinGW-W64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/tmmintrin.h:223:20: note: suggested alternative: 'builtin_ia32_pand128' return (m128i) builtin_ia32_pabsd128 ((v4si)X); ^~~~~~~ builtin_ia32_pand128 D:\Software\matconvnet-1.0-beta25\matlab\src\bits\impl\imread_gdiplus.cpp: In member function 'vl::ErrorCode vl::ImageReader::Impl::readShape(vl::ImageShape&, const char*)': D:\Software\matconvnet-1.0-beta25\matlab\src\bits\impl\imread_gdiplus.cpp:187:26: warning: control reaches end of non-void function [-Wreturn-type] Bitmap bitmap(filenamew); ^

Error in vl_compilenn>mex_compile (line 583) mex(args{:}) ;

Error in vl_compilenn (line 492) mex_compile(opts, srcs{i}, objfile, flags) ;`

divyamsaran commented 6 years ago

For me it worked my changing both C++ and C compilers to Microsoft Visual C++ 2015. Type mex -setup c++ and select Microsoft Visual C++ 2015. Do the same for C by typing mex -setup. You should get something like this after doing it (similarly for C++):

mex -setup

MEX configured to use 'Microsoft Visual C++ 2015 (C)' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. You will be required to update your code to utilize the new API. You can find more information about this at: https://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.

To choose a different C compiler, select one from the following: MinGW64 Compiler (C) mex -setup:C:\MATLAB\R2018a\bin\win64\mexopts\mingw64.xml C Microsoft Visual C++ 2015 (C) mex -setup:C:\Users\divya\AppData\Roaming\MathWorks\MATLAB\R2018a\mex_C_win64.xml C

To choose a different language, select one from the following: mex -setup C++ mex -setup FORTRAN

ongunarisev commented 5 years ago

try this, you might need to set your compiler:

% Install and compile MatConvNet (needed once). untar('http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta23.tar.gz') ; cd matconvnet-1.0-beta23 mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvc2015.xml' C mex -setup:'C:\Program Files\MATLAB\R2016b\bin\win64\mexopts\msvcpp2015.xml' C++

... rest of your code

let me know if it works for you

I can attest that a similar approach with Matlab R2018b 64-bit on Windows 10 64-bit worked for me after installing Visual Studio 2017 Community Edition with C++/C components. The commands I used with mex are as follows:

mex -setup:'C:\Program Files\MATLAB\R2018b\bin\win64\mexopts\msvc2017.xml' C -v mex -setup:'C:\Program Files\MATLAB\R2018b\bin\win64\mexopts\msvcpp2017.xml' C++ -v

I also had to modify Visual Studio through Visual Studio Installer as C/C++ compilation is not directly supported out of the box and Matlab is not able to find the compiler even if the correct xml configuration file is selected. I had to install the components

Windows 10 SDK (need to get the version to match your windows!)

VC++ 2017 v141 tools

as shown on stackoverflow. Furthermore, compiling matconvnet with GCC 6.3.0 on Windows was not possible. Both C and C++ compilers should be from VS. I tried with GCC first as I had MinGW installed on my computer.