LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

(error LNK2001): compiling CIN that requires mex.h

I'm trying to create a CIN that requires mex.h header to call Matlab functions.  However, whenever I try to compile it, I get LNK2001 errors.  I followed the LabVIEW manual on how to compile CINs and I checked my project settings etc.  I also included matrix.h and tmwtypes.h header files as required by mex.h.

Here is the beginning of my code:

#include "C:\Documents and Settings\Desktop\SINE\libsvm-mat-2.82-2\extcode.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "C:\Documents and Settings\Desktop\SINE\libsvm-mat-2.82-2\svm.h"
#include "C:\Documents and Settings\Desktop\SINE\libsvm-mat-2.82-2\mex.h"
#include "C:\Documents and Settings\Desktop\SINE\libsvm-mat-2.82-2\svm_model_matlab.h"

typedef struct {
    int32 dimSize;
    float64 elt[1];
    } TD1;
typedef TD1 **TD1Hdl;

#define CMD_LEN 2048

MgErr CINRun(LStrHandle ModelFileName, TD1Hdl Labels, TD1Hdl attributes,
             TD1Hdl predictedlevel);

MgErr CINRun(LStrHandle ModelFileName, TD1Hdl Labels, TD1Hdl attributes,
             TD1Hdl predictedlevel);


Here are the error messages I am receiving:

svmpredict2.obj : error LNK2001: unresolved external symbol _mxGetPr
svmpredict2.obj : error LNK2001: unresolved external symbol _mxGetJc_730
svmpredict2.obj : error LNK2001: unresolved external symbol _mxGetIr_730
svmpredict2.obj : error LNK2001: unresolved external symbol _mxCreateDoubleMatrix_730
svmpredict2.obj : error LNK2001: unresolved external symbol _mxDestroyArray
svmpredict2.obj : error LNK2001: unresolved external symbol _mexCallMATLAB
svmpredict2.obj : error LNK2001: unresolved external symbol _mxDuplicateArray
svmpredict2.obj : error LNK2001: unresolved external symbol _mxIsSparse
svmpredict2.obj : error LNK2001: unresolved external symbol _mexPrintf
svmpredict2.obj : error LNK2001: unresolved external symbol _mxGetM
svmpredict2.obj : error LNK2001: unresolved external symbol _mxGetN
svmpredict2.obj : error LNK2001: unresolved external symbol _matlab_matrix_to_model
svmpredict2.obj : error LNK2001: unresolved external symbol _mxGetString_730
svmpredict2.obj : error LNK2001: unresolved external symbol _mxIsStruct
lvsb.lib(lvsbmain.obj) : error LNK2001: unresolved external symbol _gLVExtCodeDispatchTable
lvsb.lib(lvsbmain.obj) : error LNK2001: unresolved external symbol _LVSBHead
Debug/predict.dll : fatal error LNK1120: 16 unresolved externals
Error executing link.exe.

predict.dll - 17 error(s), 0 warning(s)


Thanks a lot

0 Kudos
Message 1 of 3
(2,909 Views)
Or is there any other way that I can call a C code from Labview that requires calling matlab as well?
Thanks again
0 Kudos
Message 2 of 3
(2,908 Views)
kay88,

You could create a DLL and call that from LabVIEW.

What compiler are you using to create your CIN?
Regards,

Jared Boothe
Staff Hardware Engineer
National Instruments
0 Kudos
Message 3 of 3
(2,879 Views)