I'm trying to compile some files into MEX and I get a linkage error.
- helloworld.cpp which includes gateway function
- ftdi.h class declaration
- ftdi.cpp a source file
- FTD2XX.h and FTD2XX.lib a library and a header
All files are in the same folder and this folder is my current working directory in MATLAB.
I'm using MS VS2010 and MATLAB R2013a on a 64bit Windows 7. I set up the compiler using mex -setup and was able to create and run some test MEX files.
As I understand, I need to compile both helloworld.cpp and fdti.cpp when I run
mex helloworld.cpp fdti.cpp
ftdi.obj : error LNK2019: unresolved external symbol __imp_FT_ListDevices referenced in function "public: int __cdecl ftdi::GetDeviceCount(void)" (?GetDeviceCount@ftdi@@QEAAHXZ)
ftdi.obj : error LNK2019: unresolved external symbol __imp_FT_Open referenced in function "public: int __cdecl ftdi::OpenDevice(int)" (?OpenDevice@ftdi@@QEAAHH@Z)
and more of similar errors.
are functions in ftdi.cpp
I also tried:
and got similar errors. When I tried:
mex -IC:\Users\tnosov\Documents\MATLAB\newtest20nov helloworld.cpp
this is the path to where all my files are located and I got the same errors.
I've been stuck with this problem for many days now, I tried many other things I found here and in other places on the internet, but nothing helps. I'll be thankful for any suggestions and comments.
ftdi usb; //initialize an instance of class ftdi
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs[
// mexPrintf("bye World!\n");
// cout << endl << "Error initializing device";