1

I'm trying to run a file called vl_compile.m for VLFeat and I am getting this error in regards to the mexutils.h header file:

>> vl_compile
vl_compile: assuming that Visual C++ is the active compiler
vl_compile: compiling for PCWIN64 (64 bit)
MEX C:\Users\verastegui\Documents\panorama\lib\vlfeat-0.9.21\toolbox\aib\vl_aib.c
Building with 'MinGW64 Compiler (C)'.

Error using mex
In file included from C:\Users\verastegui\Documents\panorama\lib\vlfeat-0.9.21\toolbox\aib\vl_aib.c:16:0:
C:\Users\verastegui\Documents\panorama\lib\vlfeat-0.9.21\toolbox/mexutils.h:175:10: error: expected '=', ',', ';', 'asm' or 
'__attribute__' before 'void'

EXTERN_C void __attribute__((noreturn))
         ^~~~

C:\Users\verastegui\Documents\panorama\lib\vlfeat-0.9.21\toolbox/mexutils.h: In function 'vlmxError':
C:\Users\verastegui\Documents\panorama\lib\vlfeat-0.9.21\toolbox/mexutils.h:277:1: warning: 'noreturn' function does return
}
^

Error in vl_compile (line 140)
    mex(cmd{:}) ;

Here is the macro in mexutils.h where the error actually occurs:

/* these attributes suppress undefined symbols warning with GCC */
#ifdef VL_COMPILER_GNUC
#if (! defined(HAVE_OCTAVE))
EXTERN_C void __attribute__((noreturn))
mexErrMsgIdAndTxt (const char * identifier, const char * err_msg, ...) ;
#else
extern void __attribute__((noreturn))
mexErrMsgIdAndTxt (const char *id, const char *s, ...);
#endif
#endif

And here is the function where the warning is raised:

vlmxError (VlmxErrorId errorId, char const * errorMessage, ...)
{
    MEXUTILS_RAISE_HELPER ;
    mexErrMsgIdAndTxt (formattedErrorId, formattedErrorMessage) ;
}

I've seen some fixes on StackOverflow that say to either comment out EXTERN_C void __attribute__((noreturn)) or to add a semicolon to it, but that just raises more errors. I am using the most recent version of VLFeat, and the most recent version of the MinGW compiler. I can provide more code if needed, but this is just the most recent VLFeat version. Any help would be appreciated.

Cizox
  • 165
  • 1
  • 9
  • The first line of feedback says "vl_compile: assuming that Visual C++ is the active compiler", the fourth line says "Building with 'MinGW64 Compiler (C)'." These are obviously at odds. Without knowing anything about VLFeat, I'd say you've got a configuration issue here. – Cris Luengo Jun 18 '20 at 17:19
  • Thank you for noticing that. I've been trying to configure mex to use MinGW as a C++ compiler but it still says "Building with 'MinGW64 Compiler (C)'." Do you know how to fix this? I keep running 'mex -setup cpp' but while Matlab does say that the compiler is set to the c++ version vl_compile still runs the C version of it. There is a call to 'mex(cmd{:})' in vl_compile.m – Cizox Jun 18 '20 at 17:55
  • You can’t tell `mex` to compile C code with a C++ compiler. You need to configure `mex` with both the right C and the right C++ compilers. – Cris Luengo Jun 19 '20 at 01:00

0 Answers0