Static Linking Issues Using FDT2XX.LIB with JUCE on Win Debug x64


#1

I am having some trouble static linking ftd2xx.lib on Windows when building Debug x64. The library is used as the driver for the Entecc Open DMX USB interface (lighting control).

The library instructions state that the following linker flags need to be used.

Release:
/NODEFAULTLIB:LIBCMT.LIB

Debug:
/NODEFAULTLIB:LIBCMTD.LIB

Using /NODEFAULTLIB:LIBCMT.LIB works for the Release build and everything links nicely. However, in debug mode, if I don’t use the /NODEFAULTLIB:LIBCMTD.LIB linker flag I get linker errors related to fdt2xx.lib but if I do use the flag I get linker errors for all of my JUCE code. It seems that I will have linking issues both with or without the flag. :frowning:

Does anyone know of a way to apply a /NODEFAULTLIB:LIBCMTD.LIB linker flag to just fdt2xx.lib. Are there any other possible workarounds or something else that I am missing? I have spent a few evenings scouring the web and have not come up with anything useful myself so any help is much appreciated!

These are the errors when building Debug without /NODEFAULTLIB:LIBCMTD.LIB:

1>ftd2xx.lib(FTD2XX.obj) : warning LNK4217: locally defined symbol free imported in function "unsigned long __cdecl CreateDeviceInfoList(unsigned long *)" (?CreateDeviceInfoList@@YAKPEAK@Z)
1>ftd2xx.lib(FTD2XX.obj) : warning LNK4217: locally defined symbol malloc imported in function "struct ft_private_vars * __cdecl AddDevice(void)" (?AddDevice@@YAPEAUft_private_vars@@XZ)
1>ftd2xx.lib(EEDATA.obj) : warning LNK4217: locally defined symbol fclose imported in function "public: int __cdecl TEeData::WriteToFile(char *)" (?WriteToFile@TEeData@@QEAAHPEAD@Z)
1>ftd2xx.lib(EEDATA.obj) : warning LNK4217: locally defined symbol fopen imported in function "public: int __cdecl TEeData::WriteToFile(char *)" (?WriteToFile@TEeData@@QEAAHPEAD@Z)
1>ftd2xx.lib(EEDATA.obj) : warning LNK4217: locally defined symbol fwrite imported in function "public: int __cdecl TEeData::WriteToFile(char *)" (?WriteToFile@TEeData@@QEAAHPEAD@Z)
1>ftd2xx.lib(SERIALNO.obj) : warning LNK4217: locally defined symbol _i64toa imported in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(SERIALNO.obj) : warning LNK4217: locally defined symbol _localtime64 imported in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(devcon.obj) : warning LNK4217: locally defined symbol printf imported in function "int __cdecl DumpDeviceWithInfo(void *,struct _SP_DEVINFO_DATA *,char const *)" (?DumpDeviceWithInfo@@YAHPEAXPEAU_SP_DEVINFO_DATA@@PEBD@Z)
1>ftd2xx.lib(SERIALNO.obj) : error LNK2019: unresolved external symbol __imp__strupr referenced in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(SERIALNO.obj) : error LNK2019: unresolved external symbol __imp__time64 referenced in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp_fputs referenced in function "void __cdecl FormatToStream(struct _iobuf *,unsigned long,...)" (?FormatToStream@@YAXPEAU_iobuf@@KZZ)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbschr referenced in function "int __cdecl EnumerateDevices(char const *,char const *,unsigned long,int,wchar_t * *,int (__cdecl*)(void *,struct _SP_DEVINFO_DATA *,unsigned long,void *),void *)" (?EnumerateDevices@@YAHPEBD0KHPEAPEA_WP6AHPEAXPEAU_SP_DEVINFO_DATA@@K2@Z2@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbsicmp referenced in function "bool __cdecl SplitCommandLine(int &,char * * &,int &,char * * &)" (?SplitCommandLine@@YA_NAEAHAEAPEAPEAD01@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbsnbicmp referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__ismbcalpha referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbctolower referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbctoupper referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)

These are some of the errors when building Debug with /NODEFAULTLIB:LIBCMTD.LIB (I just grabbed a few as there are over 2000 errors):

1>include_juce_graphics.obj : error LNK2019: unresolved external symbol fwrite referenced in function "void __cdecl juce::pnglibNamespace::png_default_write_data(struct juce::pnglibNamespace::png_struct_def *,unsigned char *,unsigned __int64)" (?png_default_write_data@pnglibNamespace@juce@@YAXPEAUpng_struct_def@12@PEAE_K@Z)
1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol fwrite
1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol fwrite
1>include_juce_graphics.obj : error LNK2019: unresolved external symbol __stdio_common_vsscanf referenced in function _vsscanf_l
1>include_juce_graphics.obj : error LNK2019: unresolved external symbol longjmp referenced in function "void __cdecl juce::PNGHelpers::errorCallback(struct juce::pnglibNamespace::png_struct_def *,char const *)" (?errorCallback@PNGHelpers@juce@@YAXPEAUpng_struct_def@pnglibNamespace@2@PEBD@Z)
1>include_juce_graphics.obj : error LNK2019: unresolved external symbol _setjmp referenced in function "bool __cdecl juce::PNGHelpers::readHeader(class juce::InputStream &,struct juce::pnglibNamespace::png_struct_def *,struct juce::pnglibNamespace::png_info_def *,struct _SETJMP_FLOAT128 (&)[16],unsigned int &,unsigned int &,int &,int &,int &)" (?readHeader@PNGHelpers@juce@@YA_NAEAVInputStream@2@PEAUpng_struct_def@pnglibNamespace@2@PEAUpng_info_def@52@AEAY0BA@U_SETJMP_FLOAT128@@AEAI4AEAH55@Z)
1>include_juce_gui_basics.obj : error LNK2019: unresolved external symbol "void __cdecl `eh vector copy constructor iterator'(void *,void *,unsigned __int64,unsigned __int64,void (__cdecl*)(void *,void *),void (__cdecl*)(void *))" (??__C@YAXPEAX0_K1P6AX00@ZP6AX0@Z@Z) referenced in function "public: __cdecl juce::LookAndFeel_V4::ColourScheme::ColourScheme(class juce::LookAndFeel_V4::ColourScheme const &)" (??0ColourScheme@LookAndFeel_V4@juce@@QEAA@AEBV012@@Z)
1>include_juce_gui_basics.obj : error LNK2019: unresolved external symbol wcslen referenced in function "private: static void __cdecl juce::FileChooser::showPlatformDialog(class juce::Array<class juce::File,class juce::DummyCriticalSection,0> &,class juce::String const &,class juce::File const &,class juce::String const &,bool,bool,bool,bool,bool,bool,class juce::FilePreviewComponent *)" (?showPlatformDialog@FileChooser@juce@@CAXAEAV?$Array@VFile@juce@@VDummyCriticalSection@2@$0A@@2@AEBVString@2@AEBVFile@2@1_N33333PEAVFilePreviewComponent@2@@Z)
1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol wcslen
1>include_juce_gui_basics.obj : error LNK2019: unresolved external symbol _fpreset referenced in function "private: void __cdecl juce::HWNDComponentPeer::handlePaintMessage(void)" (?handlePaintMessage@HWNDComponentPeer@juce@@AEAAXXZ)
1>include_juce_gui_basics.obj : error LNK2019: unresolved external symbol atan2 referenced in function "public: void __cdecl juce::Slider::Pimpl::handleRotaryDrag(class juce::MouseEvent const &)" (?handleRotaryDrag@Pimpl@Slider@juce@@QEAAXAEBVMouseEvent@3@@Z)
1>include_juce_gui_basics.obj : error LNK2019: unresolved external symbol fmod referenced in function "private: static void __cdecl juce::SVGState::endpointToCentreParameters(double,double,double,double,double,bool,bool,double &,double &,double &,double &,double &,double &)" (?endpointToCentreParameters@SVGState@juce@@CAXNNNNN_N0AEAN11111@Z)
1>include_juce_gui_basics.obj : error LNK2019: unresolved external symbol tanf referenced in function "float __cdecl tan(float)" (?tan@@YAMM@Z)
1>include_juce_opengl.obj : error LNK2019: unresolved external symbol strstr referenced in function "public: static bool __cdecl juce::OpenGLHelpers::isExtensionSupported(char const *)" (?isExtensionSupported@OpenGLHelpers@juce@@SA_NPEBD@Z)
1>LINK : error LNK2001: unresolved external symbol mainCRTStartup
1>ftd2xx.lib(FTD2XX.obj) : error LNK2019: unresolved external symbol __imp_free referenced in function "unsigned long __cdecl CreateDeviceInfoList(unsigned long *)" (?CreateDeviceInfoList@@YAKPEAK@Z)
1>ftd2xx.lib(FTD2XX.obj) : error LNK2019: unresolved external symbol __imp_malloc referenced in function "struct ft_private_vars * __cdecl AddDevice(void)" (?AddDevice@@YAPEAUft_private_vars@@XZ)
1>ftd2xx.lib(EEDATA.obj) : error LNK2019: unresolved external symbol __imp_fclose referenced in function "public: int __cdecl TEeData::WriteToFile(char *)" (?WriteToFile@TEeData@@QEAAHPEAD@Z)
1>ftd2xx.lib(EEDATA.obj) : error LNK2019: unresolved external symbol __imp_fopen referenced in function "public: int __cdecl TEeData::WriteToFile(char *)" (?WriteToFile@TEeData@@QEAAHPEAD@Z)
1>ftd2xx.lib(EEDATA.obj) : error LNK2019: unresolved external symbol __imp_fwrite referenced in function "public: int __cdecl TEeData::WriteToFile(char *)" (?WriteToFile@TEeData@@QEAAHPEAD@Z)
1>ftd2xx.lib(SERIALNO.obj) : error LNK2019: unresolved external symbol __imp__strupr referenced in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(SERIALNO.obj) : error LNK2019: unresolved external symbol __imp__i64toa referenced in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(SERIALNO.obj) : error LNK2019: unresolved external symbol __imp__localtime64 referenced in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(SERIALNO.obj) : error LNK2019: unresolved external symbol __imp__time64 referenced in function "public: void __cdecl TSerialNumber::Build(void)" (?Build@TSerialNumber@@QEAAXXZ)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp_fputs referenced in function "void __cdecl FormatToStream(struct _iobuf *,unsigned long,...)" (?FormatToStream@@YAXPEAU_iobuf@@KZZ)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbschr referenced in function "int __cdecl EnumerateDevices(char const *,char const *,unsigned long,int,wchar_t * *,int (__cdecl*)(void *,struct _SP_DEVINFO_DATA *,unsigned long,void *),void *)" (?EnumerateDevices@@YAHPEBD0KHPEAPEA_WP6AHPEAXPEAU_SP_DEVINFO_DATA@@K2@Z2@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbsicmp referenced in function "bool __cdecl SplitCommandLine(int &,char * * &,int &,char * * &)" (?SplitCommandLine@@YA_NAEAHAEAPEAPEAD01@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbsnbicmp referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__ismbcalpha referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbctolower referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>ftd2xx.lib(devcon.obj) : error LNK2019: unresolved external symbol __imp__mbctoupper referenced in function "int __cdecl WildCardMatch(char const *,struct IdEntry const &)" (?WildCardMatch@@YAHPEBDAEBUIdEntry@@@Z)
1>libcpmtd.lib(xlock.obj) : error LNK2019: unresolved external symbol _lock_locales referenced in function "public: __cdecl std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QEAA@H@Z)
1>libcpmtd.lib(xlock.obj) : error LNK2019: unresolved external symbol _unlock_locales referenced in function "public: __cdecl std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QEAA@XZ)
1>libcpmtd.lib(uncaught.obj) : error LNK2019: unresolved external symbol __uncaught_exception referenced in function "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ)
1>libcpmtd.lib(uncaught.obj) : error LNK2019: unresolved external symbol __uncaught_exceptions referenced in function "int __cdecl std::uncaught_exceptions(void)" (?uncaught_exceptions@std@@YAHXZ)
1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol _wcsdup_dbg referenced in function _Getctype
1>libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol _wcsdup_dbg
1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __pctype_func referenced in function _Getctype
1>libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol __pctype_func
1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol isupper referenced in function _Tolower
1>libcpmtd.lib(xdateord.obj) : error LNK2019: unresolved external symbol ___lc_locale_name_func referenced in function _Getdateorder

Many thanks,

Chris


#2

Hey Chris,

I wish I could help you here.
Unfortunately, I have spent the better part of 2 days working on integrating the ftd2xx static library with Juce. I’ve had no more luck than you.
I want so badly to control my openDMX device through a Juce-made audio plugin.

It’s been a while since you posted. Were you able to figure this out?

Thanks,
Spenser


#3

Hello,

this is a typical problem for Windows when using C-Runtime “build in” or external from DLL.
Sometime not real resolvable. My suggestion, forget the static FTDI library and use the DLL from FTDI. Use GetProcAddress for all needed functions. It is a simple task.

regards
elli


#4

Thank you elli!

The dynamic library worked immediately after I copied the files over, no troubleshooting :star_struck:

At least I can move on to the dynamic library with the assurance that I’m not missing some obvious fix.


#5

Hi Spenser & Elli,

I never did get this working but will try the above suggestion. Thanks for your input! I was tearing my hair out trying to get it working before!

Cheers,

Chris :slightly_smiling_face:


#6

Hey Guys,

I know it’s been a while but thought I’d mention that I got this working nicely in the end. I am just using the .DLL for Windows builds and the static library for all other platforms.

Cheers,

Chris :slight_smile: