Linker failure when building using Visual Studio 2019

Peter Mortimer 1 Reputation point
2020-10-09T14:16:32.687+00:00

My project is being moved from Visual Studio 2010 to Visual Studio 2019 and I am trying to evaluate and solve issues. When I build my project using VS2019 I get the following linker errors:

libpost.lib(sucfile.obj) : error LNK2019: unresolved external symbol __daylight referenced in function __totalsec
libpost.lib(sucfile.obj) : error LNK2019: unresolved external symbol __timezone referenced in function __totalsec
libpost.lib(l_getenv.obj) : error LNK2019: unresolved external symbol __environ referenced in function _pXtWgzN5X32ssD34ZpsSW

The libpost.lib is provided by a third party company and I cannot rebuild it or find the source for it. I know that _daylight and _timezone have been deprecated by Microsoft. I have tried to add the legacy_stdio_definitions.lib to my library path but I still get the failures.

I have gone down the route of installing the VS2010 toolset/sdk/compiler which I have success in building with, but company policy is telling me I cannot use unsupported toolsets etc because of potential security issues.

My question is - is there another legacy lib I can include from Microsoft to get around this problem, or has anyone else had a similar problem and know of a workaround.

Thanks in advance, Pete.

Developer technologies Visual Studio Other
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 49,536 Reputation points
    2020-10-09T14:36:12.017+00:00

    If you cannot rebuild libpost.lib using VS2019 and legacy_stdio_definitions.lib does not resolve the symbols then Microsoft suggests wrapping the static library in a DLL.

    Refer to overview-of-potential-upgrade-issues-visual-cpp

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.