So here's my solution and explanation:
The error I got:
error LNK2019: unresolved external symbol __imp_FT_ListDevices referenced in function "public: int __cdecl ftdi::GetDeviceCount(void)" (?GetDeviceCount@ftdi@@QEAAHXZ)
This means that in the function ftdi::GetDeviceCount(void) the program couldn't understand what FT_ListDevices means. The declaration and definition of FT_ListDevices was in a library called ftd2xx. What I was trying to do initially, when I was trying to compile MEX file I was trying to link my program with ftd2xx.dll. However, for MEX files you need to link them with lib library, ftd2xx.lib. So I found and downloaded lib version of the library and run this command:
mex -lFTD2XX -L"C:\Users\tnosov\Downloads\CDM 2.08.30 WHQL Certified (1)\CDM v2.08.30 WHQL Certified\amd64" control_robot.cpp ftdi.cpp
is the name of the library. Note that this is lower case "L" and there's no space between -l and name of the library. Also, MATLAB adds .lib after whatever you wrote there.
-L"C:\Users\tnosov\Downloads\CDM 2.08.30 WHQL Certified (1)\CDM v2.08.30 WHQL Certified\amd64"
is location of that library. No space after -L and put quotes around path
are the files where my code is. In this files I also included header for that library that caused me problems:
#include "C:\Users\tnosov\Dropbox\CO-OP2013\not shared\Code\interfacing_matlab_cpp\CDM 2.08.30 WHQL Certified\CDM v2.08.30 WHQL Certified\ftd2xx.h"
The way I included this header is a pretty horrible programming practice, but it works.
I hope this helps! Let me know if you have run into any kind of similar questions. I spent 2 weeks trying to fix this. I'll be glad to help you!