[Top][All Lists]

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

MEX compilation problem---error: `xyz' undefined

From: Steve C. Thompson
Subject: MEX compilation problem---error: `xyz' undefined
Date: Thu, 29 Mar 2007 16:47:23 -0700

Dear Group,

First, thanks for your help with

I now have 2.9.10 installed on my Ubuntu system.

With David Bateman's help
I've compiled the MEX files from .  After running

  mkoctfile-2.9.10 -o Capacity.oct --mex Capacity.c

and seeing Capacity.oct on the other end, with no apparent
errors, a almost teared up.

Unfortunately, the jubilation has transitioned to frustration, as
is often the case.

This is probably trivial (hopefully): issuing

  a = CreateUmtsInterleaver (100)

I get

  error: `CreateUmtsInterleaver' undefined near line 1 column 5

`CreateUmtsInterleaver' is a oct-file generated, like Capacity
above, with:

  mkoctfile-2.9.10 -o CreateUmtsInterleaver.oct --mex

(I've commented out `matrix.h' in CreateUmtsInterleaver.c .)
Running that command seems to work fine, no errors or warnings
stated.  I fire up Octave in the directory where mkoctfile-2.9.10
was ran, where the oct-file is, and:

  octave-2.9.10:1> CreateUmtsInterleaver (100)
  error: `CreateUmtsInterleaver' undefined near line 1 column 1

I've tried chmod, 755 and 777.  Since the oct-file is in the
working directory, I wouldn't think the path is an issue.  I use
addpath anyways, to no avail.


  1) I'm missing something trivial (hopefully), or
  2) something is wrong with my compilation process of the MEX

Please note, I've read through't-perform-indexing-t3227971.html
, and don't think that has anything to do with my problem.  In
case 2) is at issue, I've pasted CreateUmtsInterleaver.c below.
Also note, I'm getting this same problem with the oct-files I

Thanks for you help.



/* file: CreateUmtsInterleaver.c

   Description: Produce an interleaver according to the UMTS spec.

   The calling syntax is:

                [alpha] = CreateUmtsInterleaver( K )

         alpha  = the interleaver in a length K vector 
         K  = the size of the interleaver 

   Copyright (C) 2005-2006, Matthew C. Valenti

   Last updated on June 10, 2006

   Function CreateUmtsInterleaver is part of the Iterative Solutions 
   Coded Modulation Library. The Iterative Solutions Coded Modulation 
   Library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Lesser General Public License as
   by the Free Software Foundation; either version 2.1 of the License, 
   or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   Lesser General Public License for more details.
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301

#include <math.h>
#include <mex.h>
/*#include <matrix.h>
#include <stdlib.h>

/* library of functions */
#include "./include/interleaver.h"

/* Input Arguments */
#define INPUT      prhs[0]

/* Output Arguments */
#define OUTPUT     plhs[0]

/* main function that interfaces with MATLAB */
void mexFunction(
        int                     nlhs,
        mxArray         *plhs[],
        int                     nrhs,
        const mxArray   *prhs[] )
        int     DataLength;
    double      *output_p;
        int     *alpha_code; /* interleaver */
    int     *interleaver_input; /* Temporary array used to initialize
the interleaver. */
        int     i;

        /* Check for proper number of arguments */
        if (nrhs < 1) {
                mexErrMsgTxt("[alpha] = CreateUmtsInterleaver( K )");
        } else if (nlhs > 2) {
                mexErrMsgTxt("[alpha] = CreateUmtsInterleaver( K )");
        /* initialize the input data */
        DataLength   = (int) *mxGetPr(INPUT);

        if ( (DataLength < 40)|( DataLength > 5114) )
                mexErrMsgTxt("CreateUmtsInterleaver: Input must be between 40 

        /* Create the interleaver */
        alpha_code = calloc( DataLength, sizeof(int) );
        interleaver_input = calloc( DataLength, sizeof(int) );
        for (i=0;i<DataLength;i++)
                interleaver_input[i] = i;
        CreateUmtsInterleaver( DataLength, interleaver_input, alpha_code );

        /* Output encoded data */
        OUTPUT = mxCreateDoubleMatrix(1, DataLength, mxREAL);
        output_p = mxGetPr(OUTPUT);

        for (i=0;i<DataLength;i++) {
                output_p[i] = alpha_code[i];

        free( alpha_code );
        free( interleaver_input );


reply via email to

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