Hi,
I tried to compile your code using Ubuntu 14.04 with matlab 2014b I got mistakes:
g++ solver_3_0.o linpack.o timer.o blas.o matlabexception.o matlabscalar.o matlabstring.o matlabmatrix.o arrayofmatrices.o program.o matlabprogram.o lbfgsb.o -shared -o lbfgsb.mexa64 -L/usr/local/MATLAB/R2014b/bin/glnxa64 -lgfortran -lm
/usr/bin/ld: i386 architecture of input file solver_3_0.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filelinpack.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file timer.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input fileblas.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file matlabexception.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filematlabscalar.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file matlabstring.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filematlabmatrix.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file arrayofmatrices.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input fileprogram.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file matlabprogram.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filelbfgsb.o' is incompatible with i386:x86-64 output
matlabscalar.o: In function getMatlabScalar(mxArray_tag const*)': matlabscalar.cpp:(.text+0x18): undefined reference tomxIsDouble'
matlabscalar.cpp:(.text+0x24): undefined reference to mxGetNumberOfElements' matlabscalar.cpp:(.text+0x31): undefined reference tomxGetPr'
matlabscalar.o: In function createMatlabScalar(mxArray_tag*&)': matlabscalar.cpp:(.text+0xa5): undefined reference tomxCreateDoubleScalar'
matlabscalar.cpp:(.text+0xb3): undefined reference to mxGetPr' matlabstring.o: In functioncopystring(char const_)':
matlabstring.cpp:(.text+0x24): undefined reference to operator new[](unsigned int)' matlabstring.o: In functionMatlabString::MatlabString(mxArray_tag const_)':
matlabstring.cpp:(.text+0x63): undefined reference to mxIsChar' matlabstring.cpp:(.text+0x6f): undefined reference tomxArrayToString'
matlabstring.o: In function MatlabString::~MatlabString()': matlabstring.cpp:(.text+0x12d): undefined reference tomxFree'
matlabmatrix.o: In function getMatlabMatrixDouble(mxArray_tag const*)': matlabmatrix.cpp:(.text+0x18): undefined reference tomxGetNumberOfDimensions'
matlabmatrix.cpp:(.text+0x25): undefined reference to mxIsDouble' matlabmatrix.cpp:(.text+0x31): undefined reference tomxGetPr'
matlabmatrix.o: In function createMatlabMatrixDouble(mxArray_tag*&, int, int)': matlabmatrix.cpp:(.text+0xb7): undefined reference tomxCreateDoubleMatrix'
matlabmatrix.cpp:(.text+0xc5): undefined reference to mxGetPr' matlabmatrix.o: In functionMatrix::Matrix(int, int)':
matlabmatrix.cpp:(.text+0x119): undefined reference to operator new[](unsigned int)' matlabmatrix.o: In functionMatrix::Matrix(mxArray_tag const_)':
matlabmatrix.cpp:(.text+0x17e): undefined reference to mxGetNumberOfElements' matlabmatrix.cpp:(.text+0x199): undefined reference tomxGetM'
matlabmatrix.cpp:(.text+0x1a4): undefined reference to mxGetN' arrayofmatrices.o: In functionArrayOfMatrices::ArrayOfMatrices(mxArray_tag const__, int)':
arrayofmatrices.cpp:(.text+0x43): undefined reference to operator new[](unsigned int)' arrayofmatrices.cpp:(.text+0x80): undefined reference tooperator new(unsigned int)'
arrayofmatrices.o: In function ArrayOfMatrices::ArrayOfMatrices(mxArray_tag__, ArrayOfMatrices const&)': arrayofmatrices.cpp:(.text+0x123): undefined reference to operator new[](unsigned int)'
arrayofmatrices.cpp:(.text+0x17e): undefined reference tooperator new(unsigned int)' arrayofmatrices.o: In function ArrayOfMatrices::ArrayOfMatrices(double_, ArrayOfMatrices const&)':
arrayofmatrices.cpp:(.text+0x274): undefined reference to operator new[](unsigned int)' arrayofmatrices.cpp:(.text+0x2d2): undefined reference tooperator new(unsigned int)'
arrayofmatrices.o: In function ArrayOfMatrices::getnummatlabmatrices(mxArray_tag const*)': arrayofmatrices.cpp:(.text+0x478): undefined reference tomxIsCell'
arrayofmatrices.cpp:(.text+0x484): undefined reference to mxGetNumberOfDimensions' arrayofmatrices.cpp:(.text+0x4d1): undefined reference tomxGetNumberOfElements'
arrayofmatrices.cpp:(.text+0x4e4): undefined reference to mxIsDouble' arrayofmatrices.o: In functionArrayOfMatrices::ArrayOfMatrices(mxArray_tag const_)':
arrayofmatrices.cpp:(.text+0x548): undefined reference to operator new[](unsigned int)' arrayofmatrices.cpp:(.text+0x579): undefined reference tomxIsCell'
arrayofmatrices.cpp:(.text+0x59c): undefined reference to mxGetCell' arrayofmatrices.cpp:(.text+0x5ac): undefined reference tooperator new(unsigned int)'
arrayofmatrices.cpp:(.text+0x5e0): undefined reference to operator new(unsigned int)' program.o: In functionProgram::initStructures()':
program.cpp:(.text+0x427): undefined reference to operator new[](unsigned int)' program.cpp:(.text+0x45d): undefined reference tooperator new[](unsigned int)'
program.cpp:(.text+0x47d): undefined reference to operator new[](unsigned int)' program.o: In functionProgram::Program(int, int, int, double, double)':
program.cpp:(.text+0x55b): undefined reference to operator new[](unsigned int)' program.cpp:(.text+0x566): undefined reference tooperator new[](unsigned int)'
program.o:program.cpp:(.text+0x571): more undefined references to operator new[](unsigned int)' follow matlabprogram.o: In functionMatlabProgram::~MatlabProgram()':
matlabprogram.cpp:(.text+0x7d): undefined reference to mxDestroyArray' matlabprogram.o: In functionMatlabProgram::computeObjective(int, double_)':
matlabprogram.cpp:(.text+0x32a): undefined reference to mexCallMATLAB' matlabprogram.cpp:(.text+0x358): undefined reference tomxDestroyArray'
matlabprogram.o: In function MatlabProgram::computeGradient(int, double*, double*)': matlabprogram.cpp:(.text+0x423): undefined reference tomexCallMATLAB'
matlabprogram.cpp:(.text+0x4c2): undefined reference to mxDestroyArray' matlabprogram.o: In functionMatlabProgram::iterCallback(int, double_, double)':
matlabprogram.cpp:(.text+0x618): undefined reference to mexCallMATLAB' matlabprogram.o: In functiongetBoundType(double&, double&)':
matlabprogram.cpp:(.text+0x691): undefined reference to mxIsInf' matlabprogram.cpp:(.text+0x6a0): undefined reference tomxIsInf'
matlabprogram.o: In function MatlabProgram::MatlabProgram(ArrayOfMatrices&, ArrayOfMatrices const&, ArrayOfMatrices const&, MatlabString const_, MatlabString const_, MatlabString const_, mxArray_tag_, int, int, double, double)': matlabprogram.cpp:(.text+0x7bb): undefined reference to operator new[](unsigned int)'
matlabprogram.cpp:(.text+0x7de): undefined reference tooperator new[](unsigned int)' matlabprogram.cpp:(.text+0x801): undefined reference to operator new[](unsigned int)'
matlabprogram.cpp:(.text+0x824): undefined reference tooperator new[](unsigned int)' matlabprogram.cpp:(.text+0x8e4): undefined reference to operator new[](unsigned int)'
matlabprogram.cpp:(.text+0x8f6): undefined reference tooperator new(unsigned int)' matlabprogram.cpp:(.text+0x952): undefined reference to operator new[](unsigned int)'
matlabprogram.cpp:(.text+0x9de): undefined reference tooperator new[](unsigned int)' matlabprogram.cpp:(.text+0x9f2): undefined reference to operator new(unsigned int)'
matlabprogram.cpp:(.text+0xa22): undefined reference tooperator new(unsigned int)' lbfgsb.o: In function mexFunction':
lbfgsb.cpp:(.text+0x2d6): undefined reference tomxIsEmpty' lbfgsb.cpp:(.text+0x2fd): undefined reference to mxIsEmpty'
lbfgsb.cpp:(.text+0x499): undefined reference tomxGetEps' lbfgsb.cpp:(.text+0x552): undefined reference to operator new(unsigned int)'
lbfgsb.cpp:(.text+0x615): undefined reference to`mexErrMsgTxt'
/usr/bin/ld: solver_3_0.o: file class ELFCLASS32 incompatible with ELFCLASS64
/usr/bin/ld: final link failed: File in wrong format
collect2: error: ld returned 1 exit status
make: *_* [lbfgsb_nomex] Error 1
gpml toolbox is compiled
Do you have any idea how to solve that?
Hi,
I tried to compile your code using Ubuntu 14.04 with matlab 2014b I got mistakes:
g++ solver_3_0.o linpack.o timer.o blas.o matlabexception.o matlabscalar.o matlabstring.o matlabmatrix.o arrayofmatrices.o program.o matlabprogram.o lbfgsb.o -shared -o lbfgsb.mexa64 -L/usr/local/MATLAB/R2014b/bin/glnxa64 -lgfortran -lm
/usr/bin/ld: i386 architecture of input file
solver_3_0.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filelinpack.o' is incompatible with i386:x86-64 output/usr/bin/ld: i386 architecture of input file
timer.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input fileblas.o' is incompatible with i386:x86-64 output/usr/bin/ld: i386 architecture of input file
matlabexception.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filematlabscalar.o' is incompatible with i386:x86-64 output/usr/bin/ld: i386 architecture of input file
matlabstring.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filematlabmatrix.o' is incompatible with i386:x86-64 output/usr/bin/ld: i386 architecture of input file
arrayofmatrices.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input fileprogram.o' is incompatible with i386:x86-64 output/usr/bin/ld: i386 architecture of input file
matlabprogram.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input filelbfgsb.o' is incompatible with i386:x86-64 outputmatlabscalar.o: In function
getMatlabScalar(mxArray_tag const*)': matlabscalar.cpp:(.text+0x18): undefined reference tomxIsDouble'matlabscalar.cpp:(.text+0x24): undefined reference to
mxGetNumberOfElements' matlabscalar.cpp:(.text+0x31): undefined reference tomxGetPr'matlabscalar.o: In function
createMatlabScalar(mxArray_tag*&)': matlabscalar.cpp:(.text+0xa5): undefined reference tomxCreateDoubleScalar'matlabscalar.cpp:(.text+0xb3): undefined reference to
mxGetPr' matlabstring.o: In functioncopystring(char const_)':matlabstring.cpp:(.text+0x24): undefined reference to
operator new[](unsigned int)' matlabstring.o: In functionMatlabString::MatlabString(mxArray_tag const_)':matlabstring.cpp:(.text+0x63): undefined reference to
mxIsChar' matlabstring.cpp:(.text+0x6f): undefined reference tomxArrayToString'matlabstring.o: In function
MatlabString::~MatlabString()': matlabstring.cpp:(.text+0x12d): undefined reference tomxFree'matlabmatrix.o: In function
getMatlabMatrixDouble(mxArray_tag const*)': matlabmatrix.cpp:(.text+0x18): undefined reference tomxGetNumberOfDimensions'matlabmatrix.cpp:(.text+0x25): undefined reference to
mxIsDouble' matlabmatrix.cpp:(.text+0x31): undefined reference tomxGetPr'matlabmatrix.o: In function
createMatlabMatrixDouble(mxArray_tag*&, int, int)': matlabmatrix.cpp:(.text+0xb7): undefined reference tomxCreateDoubleMatrix'matlabmatrix.cpp:(.text+0xc5): undefined reference to
mxGetPr' matlabmatrix.o: In functionMatrix::Matrix(int, int)':matlabmatrix.cpp:(.text+0x119): undefined reference to
operator new[](unsigned int)' matlabmatrix.o: In functionMatrix::Matrix(mxArray_tag const_)':matlabmatrix.cpp:(.text+0x17e): undefined reference to
mxGetNumberOfElements' matlabmatrix.cpp:(.text+0x199): undefined reference tomxGetM'matlabmatrix.cpp:(.text+0x1a4): undefined reference to
mxGetN' arrayofmatrices.o: In functionArrayOfMatrices::ArrayOfMatrices(mxArray_tag const__, int)':arrayofmatrices.cpp:(.text+0x43): undefined reference to
operator new[](unsigned int)' arrayofmatrices.cpp:(.text+0x80): undefined reference tooperator new(unsigned int)'arrayofmatrices.o: In function
ArrayOfMatrices::ArrayOfMatrices(mxArray_tag__, ArrayOfMatrices const&)': arrayofmatrices.cpp:(.text+0x123): undefined reference tooperator new[](unsigned int)'arrayofmatrices.cpp:(.text+0x17e): undefined reference to
operator new(unsigned int)' arrayofmatrices.o: In functionArrayOfMatrices::ArrayOfMatrices(double_, ArrayOfMatrices const&)':arrayofmatrices.cpp:(.text+0x274): undefined reference to
operator new[](unsigned int)' arrayofmatrices.cpp:(.text+0x2d2): undefined reference tooperator new(unsigned int)'arrayofmatrices.o: In function
ArrayOfMatrices::getnummatlabmatrices(mxArray_tag const*)': arrayofmatrices.cpp:(.text+0x478): undefined reference tomxIsCell'arrayofmatrices.cpp:(.text+0x484): undefined reference to
mxGetNumberOfDimensions' arrayofmatrices.cpp:(.text+0x4d1): undefined reference tomxGetNumberOfElements'arrayofmatrices.cpp:(.text+0x4e4): undefined reference to
mxIsDouble' arrayofmatrices.o: In functionArrayOfMatrices::ArrayOfMatrices(mxArray_tag const_)':arrayofmatrices.cpp:(.text+0x548): undefined reference to
operator new[](unsigned int)' arrayofmatrices.cpp:(.text+0x579): undefined reference tomxIsCell'arrayofmatrices.cpp:(.text+0x59c): undefined reference to
mxGetCell' arrayofmatrices.cpp:(.text+0x5ac): undefined reference tooperator new(unsigned int)'arrayofmatrices.cpp:(.text+0x5e0): undefined reference to
operator new(unsigned int)' program.o: In functionProgram::initStructures()':program.cpp:(.text+0x427): undefined reference to
operator new[](unsigned int)' program.cpp:(.text+0x45d): undefined reference tooperator new[](unsigned int)'program.cpp:(.text+0x47d): undefined reference to
operator new[](unsigned int)' program.o: In functionProgram::Program(int, int, int, double, double)':program.cpp:(.text+0x55b): undefined reference to
operator new[](unsigned int)' program.cpp:(.text+0x566): undefined reference tooperator new[](unsigned int)'program.o:program.cpp:(.text+0x571): more undefined references to
operator new[](unsigned int)' follow matlabprogram.o: In functionMatlabProgram::~MatlabProgram()':matlabprogram.cpp:(.text+0x7d): undefined reference to
mxDestroyArray' matlabprogram.o: In functionMatlabProgram::computeObjective(int, double_)':matlabprogram.cpp:(.text+0x32a): undefined reference to
mexCallMATLAB' matlabprogram.cpp:(.text+0x358): undefined reference tomxDestroyArray'matlabprogram.o: In function
MatlabProgram::computeGradient(int, double*, double*)': matlabprogram.cpp:(.text+0x423): undefined reference tomexCallMATLAB'matlabprogram.cpp:(.text+0x4c2): undefined reference to
mxDestroyArray' matlabprogram.o: In functionMatlabProgram::iterCallback(int, double_, double)':matlabprogram.cpp:(.text+0x618): undefined reference to
mexCallMATLAB' matlabprogram.o: In functiongetBoundType(double&, double&)':matlabprogram.cpp:(.text+0x691): undefined reference to
mxIsInf' matlabprogram.cpp:(.text+0x6a0): undefined reference tomxIsInf'matlabprogram.o: In function
MatlabProgram::MatlabProgram(ArrayOfMatrices&, ArrayOfMatrices const&, ArrayOfMatrices const&, MatlabString const_, MatlabString const_, MatlabString const_, mxArray_tag_, int, int, double, double)': matlabprogram.cpp:(.text+0x7bb): undefined reference tooperator new[](unsigned int)'matlabprogram.cpp:(.text+0x7de): undefined reference to
operator new[](unsigned int)' matlabprogram.cpp:(.text+0x801): undefined reference tooperator new[](unsigned int)'matlabprogram.cpp:(.text+0x824): undefined reference to
operator new[](unsigned int)' matlabprogram.cpp:(.text+0x8e4): undefined reference tooperator new[](unsigned int)'matlabprogram.cpp:(.text+0x8f6): undefined reference to
operator new(unsigned int)' matlabprogram.cpp:(.text+0x952): undefined reference tooperator new[](unsigned int)'matlabprogram.cpp:(.text+0x9de): undefined reference to
operator new[](unsigned int)' matlabprogram.cpp:(.text+0x9f2): undefined reference tooperator new(unsigned int)'matlabprogram.cpp:(.text+0xa22): undefined reference to
operator new(unsigned int)' lbfgsb.o: In functionmexFunction':lbfgsb.cpp:(.text+0x2d6): undefined reference to
mxIsEmpty' lbfgsb.cpp:(.text+0x2fd): undefined reference tomxIsEmpty'lbfgsb.cpp:(.text+0x499): undefined reference to
mxGetEps' lbfgsb.cpp:(.text+0x552): undefined reference tooperator new(unsigned int)'lbfgsb.cpp:(.text+0x615): undefined reference to`mexErrMsgTxt'
/usr/bin/ld: solver_3_0.o: file class ELFCLASS32 incompatible with ELFCLASS64
/usr/bin/ld: final link failed: File in wrong format
collect2: error: ld returned 1 exit status
make: *_* [lbfgsb_nomex] Error 1
gpml toolbox is compiled
Do you have any idea how to solve that?