Thu 16 Aug 2012 02:11:47 PM UTC, original submission:
Octave version: 3.6.1 gcc4.6.2 (i686-pc-mingw32)
Octave errors out with a multiple definition error when compiling a mex file with two additional compilation units f.c and g.c, which are located in a subdirectory:
> mex mex_test.c subdir/f.c subdir/g.c
subdir.o: In function `g':
C:\.../subdir/g.c:1: multiple definition of `g'
subdir.o:C:\.../subdir/g.c:1: first defined here
collect2: ld returned 1 exit status
It seems that Octave creates a subdir.o instead of f.o and g.o, and then it gets confused.
I tested the same in Matlab 2011b on Linux/Windows and Octave 3.4.3 on Linux, where it works as expected (no error).
Here are minimal file contents to reproduce the error:
/* file: mex_test.c */
#include "mex.h"
void mexFunction(int nlhs, mxArray plhs[], int nrhs, mxArray const prhs[]) {}
/* file: subdir/f.c */
void f() {}
/* file: subdir/g.c */
void g() {}
|