cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TomasCvincek
Level 3

error LNK2019: unresolved external symbol __iob_func

Jump to solution

Hello guys,

I am updating Flexnet on our software and I am facing following error:
libredir_std.lib(lm_redir_std.obj) : error LNK2019: unresolved external symbol __iob_func referenced in function lm_flex_stderr.

I am updating Flexnet from version 11.14 to 11.18.

I found some hints on stackoverflow:
https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2

I implemented missing function where needed on my own:

FILE _iob[] = {*stdin, *stdout, *stderr};

extern "C" FILE * __cdecl __iob_func(void)
{
  return _iob;
}


With this function implemented in DLLs that require Flexnet, it compiles successfully and runtime seems OK as well.
But I do not think this is good solution - it is more like a workaround. Why does libredir_std.lib requires this function? When I checked Flexnet version 11.14, it used __acrt_iob_func instead of __iob_func
How can I fix this? Is there any other way to do it than defining this function on my own?

I build our app using Visual Studio 2015. Here are dependencies:

FNP_Act_Installer
libFNPload
libcrvs
libFNPload
liblmutil
libpthread
libsb
libsimplifier
lmgr
lmgras
lmgrd 
lmgrs
lmgr_dongle
lmgr_dongle_stub
lmgr_trl
lmsign
libredir_std.lib
userenv.lib
iphlpapi.lib
legacy_stdio_wide_specifiers.lib
legacy_stdio_definitions.lib

linker options:

lm_new.obj 
/NODEFAULTLIB:LIBCMT.lib


Thanks for answers in advance.

Tomas C.

0 Kudos
(1) Solution

Hi  @mrathinam ,

I have probably used wrong distribution of Flexnet (for newer Visual Studio).

When I used correct one for Visual Studio 2015, this __iob_func is not used.  __acrt_iob_func is used instead of  __iob_func.


Thanks. 

Tomas C.

 

 

View solution in original post

0 Kudos
(7) Replies
Yvernekar
Level 6 Flexeran
Level 6 Flexeran

The LNK2019 error is usually due to a missing lib file. Below is a list that I refer. Can you please check if something is missing on your end:

lmflex.obj

lm_new.obj

lmgr_trl.lib

libsb.lib

libcrvs.lib

libpthread.lib

libredir_std.lib

libredir_std.lib

legacy_stdio_wide_specifiers.lib

legacy_stdio_definitions.lib

libvcruntime.lib

libucrt.lib

oldnames.lib

kernel32.lib

user32.lib

netapi32.lib

gdi32.lib

comdlg32.lib

comctl32.lib

wsock32.lib

shell32.lib

Rpcrt4.lib

oleaut32.lib

Ole32.lib

Wbemuuid.lib

wintrust.lib

crypt32.lib

Ws2_32.lib

iphlpapi.lib

Psapi.lib

advapi32.lib

Shlwapi.lib

dhcpcsvc.lib

userenv.lib

libcmt.lib

lmgr_dongle_stub.lib

.\activation\lib\libnoact.lib

Hi Yvernekar,

 

thanks for answer. I checked your dependency list with mine. I added libvcruntime.lib
libucrt.lib but those threw some further problems:

vcruntime.lib(VCRUNTIME140.dll) : error LNK2005: memmove already defined in libvcruntime.lib(memcpy.obj)
ucrt.lib(api-ms-win-crt-runtime-l1-1-0.dll) : error LNK2005: _invalid_parameter_noinfo_noreturn already defined in libucrt.lib(invalid_parameter.obj)
ucrt.lib(api-ms-win-crt-runtime-l1-1-0.dll) : error LNK2005: _errno already defined in libucrt.lib(errno.obj)
ucrt.lib(api-ms-win-crt-runtime-l1-1-0.dll) : error LNK2005: abort already defined in libucrt.lib(abort.obj)
ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll) : error LNK2005: __stdio_common_vfprintf already defined in libucrt.lib(output.obj)
ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll) : error LNK2005: fclose already defined in libucrt.lib(fclose.obj)
ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll) : error LNK2005: __acrt_iob_func already defined in libucrt.lib(_file.obj)
ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll) : error LNK2005: __stdio_common_vsprintf already defined in libucrt.lib(output.obj)
ucrt.lib(api-ms-win-crt-time-l1-1-0.dll) : error LNK2005: _time64 already defined in libucrt.lib(time.obj)
ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll) : error LNK2005: __stdio_common_vswprintf already defined in libucrt.lib(output.obj)
ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll) : error LNK2005: fflush already defined in libucrt.lib(fflush.obj)
ucrt.lib(api-ms-win-crt-heap-l1-1-0.dll) : error LNK2005: free already defined in libucrt.lib(free.obj)
ucrt.lib(api-ms-win-crt-heap-l1-1-0.dll) : error LNK2005: malloc already defined in libucrt.lib(malloc.obj)
ucrt.lib(api-ms-win-crt-string-l1-1-0.dll) : error LNK2005: wcsncmp already defined in libucrt.lib(wcsncmp.obj)
libucrt.lib(unlink.obj) : error LNK2005: remove already defined in ucrt.lib(api-ms-win-crt-filesystem-l1-1-0.dll)
libucrt.lib(open.obj) : error LNK2005: _wopen already defined in ucrt.lib(api-ms-win-crt-stdio-l1-1-0.dll)
libucrt.lib(environment_initialization.obj) : error LNK2005: _initialize_narrow_environment already defined in ucrt.lib(api-ms-win-crt-runtime-l1-1-0.dll)
libucrt.lib(waccess.obj) : error LNK2005: _waccess already defined in ucrt.lib(api-ms-win-crt-filesystem-l1-1-0.dll)
libucrt.lib(strnicmp.obj) : error LNK2005: _strnicmp already defined in ucrt.lib(api-ms-win-crt-string-l1-1-0.dll)

 

I am not sure.... am I using incorrect VS C++ libs? 

Do you know, which exact .lib defines this __iob_func?

 

Thanks. 🙂 

Tomas C.

0 Kudos

Hi @TomasCvincek As you are using VS 2019, please check the supported version of the VS in 11.18.0.  I think the support of VS 2019 stated from 11.19.1.0. You can find the release notes with the following information. 

A new 64bit Windows FNP kit having suffix _vc16 is made available to support newer versions of Visual Studio(VS 2017, VS 2019...etc).

The Windows FNP kits(both 32 & 64bits) without _vc16 suffix can be used to support VS 2013 and VS 2015.

Best Regards,

0 Kudos

Hi @mrathinam ,

I am using VS 2015.

Thanks.

Tomas C.

Hi @TomasCvincek can you please share the FNP kit name (Full name)

Best Regards,

0 Kudos

Hi  @mrathinam ,

I have probably used wrong distribution of Flexnet (for newer Visual Studio).

When I used correct one for Visual Studio 2015, this __iob_func is not used.  __acrt_iob_func is used instead of  __iob_func.


Thanks. 

Tomas C.

 

 

0 Kudos

@TomasCvincek Thanks for the confirmation. 

0 Kudos