Closed iammarvelous closed 8 years ago
This error suggests that your g++
might be out of date.
What output do you see if you run g++ --version
? As pointed out in this SO answer, if your g++
is older than 4.7 then -std=c++0x
needs to be supplied as an option instead.
I'm running on the same error (using g++ 4.6.3), but I can't seem to find where to edit vl_compilenn.m
to supply -std=c++0x
. Could someone help?
Thanks albanie! My output for g++ -- version
is g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
. I did not find ways to supply -std=c++0x
either. Any suggestions?
Hmm, I'm wondering where the c++11
does occur as we do not supply it in our compilation scripts :/ Can you maybe post somewhere the whole compilation log (compiling with vl_compilenn('verbose', 1, ...)
and your Matlab version somewhere? e.g. a pastebin...).
Ok, I think I found solution to this:
First run mex -setup c++
. This would create a file mex_C++_glnxa64.xml
in your prefdir
(which you can get by calling prefdir
in MATLAB). Then you can simply edit this file and replace the -std=c++11
with -std=c++0x
and hope that nothing will break :P
This is really something we cannot do anything with as it is default MATLAB mex configuration... :/
In MATLAB R2015a, Ubuntu 12.04 LTS
vl_compilenn('EnableGpu', false, 'Verbose', 1, 'ImageLibrary', 'libjpeg')
vl_compilenn: * Compiler and linker configurations *
vl_compilenn: intermediate build products directory: /nfs/scratch/sampaiod/matconvnet/matlab/mex/.build
vl_compilenn: MEX files: /nfs/scratch/sampaiod/matconvnet/matlab/mex/
vl_compilenn: MEX compiler options: -DNDEBUG -DENABLE_DOUBLE -largeArrayDims -cxx
vl_compilenn: MEX linker options: -lmwblas -ljpeg -largeArrayDims
vl_compilenn: * Reading images *
vl_compilenn: vl_imreadjpeg enabled
vl_compilenn: image library: libjpeg
vl_compilenn: image library compile flags:
vl_compilenn: image library link flags: -ljpeg
439 mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;
vl_compilenn: MEX CC: -outdir /nfs/scratch/sampaiod/matconvnet/matlab/mex/.build/bits /nfs/scratch/sampaiod/matconvnet/matlab/src/bits/data.cpp -c -DNDEBUG -DENABLE_DOUBLE -largeArrayDims -cxx
Building with 'g++'.
Error using mex
cc1plus: error: unrecognized command line option ‘-std=c++11’
Error in vl_compilenn>mex_compile (line 478)
mex(mopts{:}) ;
Error in vl_compilenn (line 439)
mex_compile(opts, srcs{i}, objfile, flags.mexcc) ;
Have you tried my previous comment? That should help. It is caused by too old version of GCC and too new version of MATLAB, so you have to hack a bit the MATLAB's configuration...
Sorry lenck, I haven't seen your previous comment. It worked after editing mex_C++_glnxa64.xml
, thanks a lot!
This is a indeed a problem of incompatibility of MATLAB and g++. I also tried compiling it with MATLAB R2012a and it worked just fine.
Ah, great to hear that! :)
Yes, I have also fixed the problem by using new version of gcc.
I have the same problem. It works on my mac. But I get issues running on computational clusters. Editing mex_C++_glnxa64.xml or updating GCC to 4.7 didn't help. Which version did you update to?
Hi,
When I compiled the code on redhat, I came across this error:
cc1plus: error: unrecognized command line option "-std=c++11"
Could you help with this?
Thanks, Marvin