<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hi, FieldTrip folks,<br>
    <br>
    I'm running FieldTrip under Matlab R2020a on macOS 10.14.6 with
    Xcode 11.3.1.<br>
    <br>
    When I try to recompile all the MEX files, I got some warnings and a
    compilation error.<br>
    <br>
    Any ideas? Maybe this MATRIX_DLL_EXPORT_SYM hack is no longer
    working under R2020a and recent versions? From
    src/mxSerialize_cpp.cpp: <br>
    <br>
    <div style="color: #333333;background-color: #fdf6e3;font-family: Menlo, Monaco, 'Courier New', monospace;font-weight: normal;font-size: 12px;line-height: 18px;white-space: pre;"><div><span style="color: #93a1a1;font-style: italic;">// MX_API_VER has unfortunately not changed between R2013b and R2014a,</span></div><div><span style="color: #93a1a1;font-style: italic;">// so we use the new MATRIX_DLL_EXPORT_SYM as an ugly hack instead</span></div><div><span style="color: #859900;">#if</span><span style="color: #b58900;"> </span><span style="color: #859900;">defined</span><span style="color: #b58900;">(</span><span style="color: #268bd2;">__cplusplus</span><span style="color: #b58900;">) </span><span style="color: #859900;">&&</span><span style="color: #b58900;"> </span><span style="color: #859900;">defined</span><span style="color: #b58900;">(</span><span style="color: #268bd2;">MATRIX_DLL_EXPORT_SYM</span><span style="color: #b58900;">)</span></div><div><span style="color: #b58900;">    </span><span style="color: #859900;">#define</span><span style="color: #b58900;"> </span><span style="color: #268bd2;">EXTERN_C</span><span style="color: #b58900;"> </span><span style="color: #073642;font-weight: bold;">extern</span></div><div><span style="color: #333333;">    </span><span style="color: #073642;font-weight: bold;">namespace</span><span style="color: #333333;"> </span><span style="color: #268bd2;">matrix</span><span style="color: #333333;">{ </span><span style="color: #073642;font-weight: bold;">namespace</span><span style="color: #333333;"> </span><span style="color: #268bd2;">detail</span><span style="color: #333333;">{ </span><span style="color: #073642;font-weight: bold;">namespace</span><span style="color: #333333;"> </span><span style="color: #268bd2;">noninlined</span><span style="color: #333333;">{ </span><span style="color: #073642;font-weight: bold;">namespace</span><span style="color: #333333;"> </span><span style="color: #268bd2;">mx_array_api</span><span style="color: #333333;">{</span></div><div><span style="color: #859900;">#endif</span></div></div>
    <br>
    <br>
    This is not urgent – I'm not actually using FieldTrip for work; just
    playing around with it after I saw Carlijn Boomen's compilation
    problems.<br>
    <br>
    Perhaps this is related to the new C++ and interleaved-complex MEX
    APIs that Matlab introduced recently?<br>
    <br>
    Details:<br>
    <br>
    >> addpath ~/local/repos/fieldtrip/<br>
    >> cd ~/local/repos/fieldtrip/utilities<br>
    >> !git log --oneline | head -10<br>
    36193a97a updated test scripts, the cfg.sourcemodel should also have
    a label if it contains a filter. Select only MEG channels for source
    analysis with pre-computed leadfield.<br>
    0e3a52de5 fixed bug in selection of optode channels that was
    intrpduced with the recent #1377<br>
    6325434a6 automatically synchronized identical files to
    0fe5399736d832b3206e778603e6427f7bd829fa<br>
    0fe539973 fixed multiple regression errors due to PR #1377, mostly
    related to sloppy data bookkeeping<br>
    6dac9ac18 automatically synchronized identical files to
    b79f65a9e7284c0f244f3c52875ba9f7479932fd<br>
    b79f65a9e improve ft_sourceanalysis flexbility to work with
    pre-computed leadfields (#1377)<br>
    b4d569823 Update feature_request.md<br>
    49b433569 Update bug_report.md<br>
    606c7d67e Update feature_request.md<br>
    a48f337db Update bug_report.md<br>
    >> ft_compile_mex(true)<br>
    Compiling MEX file compat/matlablt2010b/@uint64/abs ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file compat/matlablt2010b/@uint64/min ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file compat/matlablt2010b/@uint64/max ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file compat/matlablt2010b/@uint64/plus ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file compat/matlablt2010b/@uint64/minus ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file compat/matlablt2010b/@uint64/times ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file compat/matlablt2010b/@uint64/rdivide ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file @config/private/deepcopy ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file @config/private/increment ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file @config/private/setzero ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file realtime/online_mri/ft_omri_smooth_volume ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file realtime/src/acquisition/siemens/src/sap2matlab
    ...<br>
    Building with 'Xcode with Clang'.<br>
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/sap2matlab.c:33:10:
    warning: enumeration value 'SAP_ARRAY_SIZE' not handled in switch
    [-Wswitch]<br>
                    switch(item->type) {<br>
                           ^<br>
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/sap2matlab.c:33:10:
    note: add missing switch cases<br>
                    switch(item->type) {<br>
                           ^<br>
    1 warning generated.<br>
    <br>
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:323:12:
    warning: enumeration value 'SAP_ARRAY_SIZE' not handled in switch
    [-Wswitch]<br>
        switch(typ) {<br>
               ^<br>
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:323:12:
    note: add missing switch cases<br>
        switch(typ) {<br>
               ^<br>
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:436:20:
    warning: enumeration value 'SAP_ARRAY_SIZE' not handled in switch
    [-Wswitch]<br>
                switch(item->type) {<br>
                       ^<br>
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:436:20:
    note: add missing switch cases<br>
                switch(item->type) {<br>
                       ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/ft_getopt ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/read_16bit ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/read_24bit ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/lmoutr ...<br>
    Building with 'Xcode with Clang'.<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        proj[0] = mxGetNaN();<br>
                  ^<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        *la = mxGetNaN();<br>
              ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/ltrisect ...<br>
    Building with 'Xcode with Clang'.<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        proj[0] = mxGetNaN();<br>
                  ^<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        *la = mxGetNaN();<br>
              ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/plinproj ...<br>
    Building with 'Xcode with Clang'.<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        proj[0] = mxGetNaN();<br>
                  ^<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        *la = mxGetNaN();<br>
              ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/ptriproj ...<br>
    Building with 'Xcode with Clang'.<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        proj[0] = mxGetNaN();<br>
                  ^<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        *la = mxGetNaN();<br>
              ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/routlm ...<br>
    Building with 'Xcode with Clang'.<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        proj[0] = mxGetNaN();<br>
                  ^<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        *la = mxGetNaN();<br>
              ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/solid_angle ...<br>
    Building with 'Xcode with Clang'.<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        proj[0] = mxGetNaN();<br>
                  ^<br>
    /Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning:
    implicit declaration of function 'mxGetNaN' is invalid in C99
    [-Wimplicit-function-declaration]<br>
        *la = mxGetNaN();<br>
              ^<br>
    2 warnings generated.<br>
    <br>
    MEX completed successfully.<br>
    Compiling MEX file src/rfbevent ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/meg_leadfield1 ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/splint_gh ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/plgndr ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/ft_spike_sub_crossx ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/rename ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/getpid ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/nanmean ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/nanstd ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/nanvar ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/nansum ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/nanstd ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/det2x2 ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/inv2x2 ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/mtimes2x2 ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/sandwich2x2 ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/combineClusters ...<br>
    Building with 'Xcode Clang++'.<br>
    MEX completed successfully.<br>
    Compiling MEX file external/fileexchange/CalcMD5 ...<br>
    Building with 'Xcode with Clang'.<br>
    MEX completed successfully.<br>
    Compiling MEX file src/mxSerialize_cpp ...<br>
    Building with 'Xcode Clang++'.<br>
    Error using mex<br>
    /Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:10:1:
    error: unknown type name 'EXTERN_C'<br>
    EXTERN_C mxArray* mxSerialize(mxArray const *);<br>
    ^<br>
    /Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:10:17:
    error: expected ';' after top level declarator<br>
    EXTERN_C mxArray* mxSerialize(mxArray const *);<br>
                    ^<br>
                    ;<br>
    /Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:11:1:
    error: unknown type name 'EXTERN_C'<br>
    EXTERN_C mxArray* mxDeserialize(const void *, size_t);<br>
    ^<br>
    /Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:11:17:
    error: expected ';' after top level declarator<br>
    EXTERN_C mxArray* mxDeserialize(const void *, size_t);<br>
                    ^<br>
                    ;<br>
    /Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:22:31:
    error: use of undeclared identifier 'mxSerialize'<br>
            plhs[0] = (mxArray *) mxSerialize(prhs[0]);<br>
                                  ^<br>
    5 errors generated.<br>
    <br>
    Error in ft_compile_mex>compile_mex_list (line 217)<br>
      eval(cmd);<br>
    Error in ft_compile_mex (line 114)<br>
      compile_mex_list(L, ftpath, force); <br>
    >> ver<br>
-----------------------------------------------------------------------------------------------------<br>
    MATLAB Version: 9.8.0.1323502 (R2020a)<br>
    MATLAB License Number: 973906<br>
    Operating System: Mac OS X  Version: 10.14.6 Build: 18G4032 <br>
    Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java
    HotSpot(TM) 64-Bit Server VM mixed mode<br>
-----------------------------------------------------------------------------------------------------<br>
    MATLAB                                                Version
    9.8         (R2020a)                <br>
    Database Toolbox                                      Version
    9.2.1       (R2020a)                <br>
    FieldTrip                                             Version
    unknown     <a class="moz-txt-link-abbreviated" href="http://www.fieldtriptoolbox.org">www.fieldtriptoolbox.org</a><br>
    Financial Toolbox                                     Version
    5.15        (R2020a)                <br>
    Optimization Toolbox                                  Version
    8.5         (R2020a)                <br>
    Statistics and Machine Learning Toolbox               Version
    11.7        (R2020a)                <br>
    >> <br>
    <br>
    Cheers,<br>
    Andrew<br>
  </body>
</html>