I'm compiling a program with Visual Studio 2017 that links with the precompiled static version of libusb, available here.
When I tried to link it I got some unresolved symbols like these and the answers pointed me to legacy_stdio_definitions.lib
which resolved all of the linker errors except:
unresolved external symbol __imp__iob
This page from Microsoft talks about legacy_stdio_definitions.lib
and says it provides __imp___iob
but doesn't mention __imp__iob
(note the different number of underscores).
What's going on here?
(Also, yes mixing CRT versions is a bad idea and I should really compile libusb from source. I know.)
Had the same problem with libusb on VS2018 - 32bit, this helped me:
Hacky solution: Linker complains about some missing function -- so just give it to it -- such function should return the implementation defined IO function pointers. For statically linked libusb-1.0 I had to add the following to my code:
#pragma comment(lib, "legacy_stdio_definitions.lib")
#ifdef __cplusplus
FILE iob[] = { *stdin, *stdout, *stderr };
extern "C" {
FILE * __cdecl _iob(void) { return iob; }
}
#endif
Better solution: Simply recompile static libs under VS 2018 (which I assume you are also using) and follow carefully the Readme file attached.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With