help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More - Problems with mkoctfile using GCC 4.8.1


From: Mike Miller
Subject: Re: More - Problems with mkoctfile using GCC 4.8.1
Date: Fri, 11 Oct 2013 07:56:20 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Oct 11, 2013 at 14:54:45 +1100, Terry Duell wrote:
> OK, I don't normally work with mex files either, but have been
> revisiting some code I worked with a couple of years ago, Matlab
> code provided by others, and didn't have any problems compiling the
> xxx.c or the xxx.cpp files at that time. Trying to rebuild working
> code from my source archive, I now run into problems.
> Below is a bit of a story of what I have been able to establish,
> hope it is understandable.
> 
> using mex.h as follows...
> 
> ------------------
> #if defined (__cplusplus)
> #include "mexproto.h"  /*TLD 8-10-2013*/
> extern "C" {
> #endif
> 
> #if defined (V4)
> void mexFunction (int nlhs, mxArray* plhs[], int nrhs, mxArray *prhs[]);
> #else
> void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray
> *prhs[]);
> #endif
> 
> /*#include "mexproto.h"*/
> 
> /* V4 floating point routines renamed in V5.  */
> -----------------
> 
> errors compiling apply_blur_kernel_mex.c, but no errors compiling
> another version (apply_blur_kernel_mex.cpp in different set of code)
> 
> apply_blur_kernel_mex.c:87:62: error: ‘mxDOUBLE_CLASS’ undeclared
> (first use in this function)
>      imblurry_ptr = mxCreateNumericArray(3, full_dims_blurry,
> mxDOUBLE_CLASS, mxREAL);
>                                                               ^
> apply_blur_kernel_mex.c:87:62: note: each undeclared identifier is
> reported only once for each function it appears in
> apply_blur_kernel_mex.c:87:78: error: ‘mxREAL’ undeclared (first use
> in this function)
>      imblurry_ptr = mxCreateNumericArray(3, full_dims_blurry,
> mxDOUBLE_CLASS, mxREAL);
>                                                                               
> ^
> apply_blur_kernel_mex.c:88:14: warning: assignment makes pointer
> from integer without a cast [enabled by default]
>      imblurry = mxGetPr(imblurry_ptr);
>               ^
> apply_blur_kernel_mex.c:95:16: warning: implicit declaration of
> function ‘mexErrMsgTxt’ [-Wimplicit-function-declaration]
>                 mexErrMsgTxt("theta not integral for uniform blur");
>                 ^
> apply_blur_kernel_mex.c:107:22: error: ‘mwIndex’ undeclared (first
> use in this function)
>                  i = (mwIndex)((xi-1)*h_blurry + yi - 1);
>                       ^
> 
> with mex.h as follows (essentially the std mex.h in 3.6.4), no
> errors compiling apply_blur_kernel_mex.c but errors (in original
> post) compiling apply_blur_kernel_mex.cpp
> 
> -------------------
> #if defined (__cplusplus)
> /* #include "mexproto.h"  TLD 8-10-2013*/
> extern "C" {
> #endif
> 
> #if defined (V4)
> void mexFunction (int nlhs, mxArray* plhs[], int nrhs, mxArray *prhs[]);
> #else
> void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray
> *prhs[]);
> #endif
> 
> #include "mexproto.h"
> 
> /* V4 floating point routines renamed in V5.  */
> ----------------------
> 
> Just to be clear, I am working with Octave 3.6.4 from the Fedora 19
> repo (x86_64 version).
> Fedora 19 uses gcc-4.8.1-1.fc19.x86_64.
> 
> What version of GCC are you using.
> 
> Hope this throws a bit more light on my problem.

Yes it does. The edit you made to mex.h was slightly off, compare the
current development version to see where the change should actually be
made:

  
http://hg.savannah.gnu.org/hgweb/octave/file/811019b9ef57/libinterp/corefcn/mex.h#l67

Specifically the mexproto.h file should be included outside of the #if
block, that is why it's not working for C files for you. Try adjusting
that and let us know if it works for you.

I'm using gcc version 4.8.1 (Debian 4.8.1-10).

-- 
mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]