The ftd2xx header has a lot of Windows types in it so you need to include windows.h before including the ftdi header.
The .lib file is a DLL link library which provides the linker information required to make use of the DLL at runtime. The following compiles and runs using g++:
#include <windows.h>
#include <stdio.h>
#include <ftd2xx.h>
int main(int argc, char *argv[])
{
DWORD version = 0;
FT_STATUS status = FT_GetLibraryVersion(&version);
printf("version %ld\n", version);
return (status == FT_OK) ? 0 : 1;
}
Compiled using:
g++ -Wall -Idriver -o check.exe check.cpp driver/i386/ftd2xx.lib
where the driver
folder contains the distributed FTDI windows driver package. The -lftd2xx
will have the linker searching for something called libftd2xx.a so just explicitly provide the .lib filename.