Skip to content

Failed to link the static gdal library compiled with vcpkg on windows using vs2022 #49835

@hzhshok

Description

@hzhshok

Describe the bug
Failed to link the static gdal library compiled with vcpkg on windows using vs2022, the following is the link errors:

1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019: unresolved external symbol __std_min_element_d,referenced in function "double const * __cdecl std::__std_min_element(double const * const,double const * const)" (??$__std_min_element@$$CBN@std@@YAPEBNQEBN0@Z)
1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_min_element_d
1>Lerc.lib(Lerc2.cpp.obj) : error LNK2001: unresolved external symbol __std_min_element_d
1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019:unresolved external symbol __std_max_element_d,referenced in function "double const * __cdecl std::__std_max_element(double const * const,double const * const)" (??$__std_max_element@$$CBN@std@@YAPEBNQEBN0@Z)
1>gdald.lib(overview.cpp.obj) : error LNK2001: unresolved external symbol __std_max_element_d
1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_max_element_d
1>Lerc.lib(Lerc2.cpp.obj) : error LNK2001: unresolved external symbol __std_max_element_d
1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019:unresolved external symbol __std_min_d,referenced in function "auto __cdecl std::__std_min(double const * const,double const * const)" (??$__std_min@$$CBN@std@@ya?A_PQEBN0@Z)
1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_min_d
1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019: unresolved external symbol __std_max_d,referenced in function "auto __cdecl std::__std_max(double const * const,double const * const)" (??$__std_max@$$CBN@std@@ya?A_PQEBN0@Z)
1>gdald.lib(overview.cpp.obj) : error LNK2001: unresolved external symbol __std_max_d
1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_max_d
1>gdald.lib(gdalargumentparser.cpp.obj) : error LNK2019: unresolved external symbol __std_min_8u,referenced in function "auto __cdecl std::__std_min(unsigned __int64 const * const,unsigned __int64 const * const)" (??$__std_min@$$CB_K@std@@ya?A_PQEB_K0@Z)
1>gdald.lib(overview.cpp.obj) : error LNK2019: unresolved external symbol __std_max_element_f,referenced in function "float const * __cdecl std::__std_max_element(float const * const,float const * const)" (??$__std_max_element@$$CBM@std@@YAPEBMQEBM0@Z)
1>gdald.lib(overview.cpp.obj) : error LNK2019: unresolved external symbol __std_max_f,referenced in function "auto __cdecl std::__std_max(float const * const,float const * const)" (??$__std_max@$$CBM@std@@ya?A_PQEBM0@Z)

Environment

  • OS: win11[64bit]
  • Compiler: vs2022 - 17.14.23

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install gdal:x64-windows-static
  2. Generated gdald.lib, and use the gdald.lib on DLL project.
  3. See errorRepro code after compiling.
    1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019: unresolved external symbol __std_min_element_d,referenced in function "double const * __cdecl std::__std_min_element(double const * const,double const * const)" (??$__std_min_element@$$CBN@std@@YAPEBNQEBN0@Z)
    1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_min_element_d
    1>Lerc.lib(Lerc2.cpp.obj) : error LNK2001: unresolved external symbol __std_min_element_d
    1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019:unresolved external symbol __std_max_element_d,referenced in function "double const * __cdecl std::__std_max_element(double const * const,double const * const)" (??$__std_max_element@$$CBN@std@@YAPEBNQEBN0@Z)
    1>gdald.lib(overview.cpp.obj) : error LNK2001: unresolved external symbol __std_max_element_d
    1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_max_element_d
    1>Lerc.lib(Lerc2.cpp.obj) : error LNK2001: unresolved external symbol __std_max_element_d
    1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019:unresolved external symbol __std_min_d,referenced in function "auto __cdecl std::__std_min(double const * const,double const * const)" (??$__std_min@$$CBN@std@@ya?A_PQEBN0@Z)
    1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_min_d
    1>gdald.lib(gdaldataset.cpp.obj) : error LNK2019: unresolved external symbol __std_max_d,referenced in function "auto __cdecl std::__std_max(double const * const,double const * const)" (??$__std_max@$$CBN@std@@ya?A_PQEBN0@Z)
    1>gdald.lib(overview.cpp.obj) : error LNK2001: unresolved external symbol __std_max_d
    1>gdald.lib(gdaljp2metadata.cpp.obj) : error LNK2001: unresolved external symbol __std_max_d
    1>gdald.lib(gdalargumentparser.cpp.obj) : error LNK2019: unresolved external symbol __std_min_8u,referenced in function "auto __cdecl std::__std_min(unsigned __int64 const * const,unsigned __int64 const * const)" (??$__std_min@$$CB_K@std@@ya?A_PQEB_K0@Z)
    1>gdald.lib(overview.cpp.obj) : error LNK2019: unresolved external symbol __std_max_element_f,referenced in function "float const * __cdecl std::__std_max_element(float const * const,float const * const)" (??$__std_max_element@$$CBM@std@@YAPEBMQEBM0@Z)
    1>gdald.lib(overview.cpp.obj) : error LNK2019: unresolved external symbol __std_max_f,referenced in function "auto __cdecl std::__std_max(float const * const,float const * const)" (??$__std_max@$$CBM@std@@ya?A_PQEBM0@Z)

Expected behavior
The project can pass compile normally using gdald.lib

Failure logs
See the error.

Additional context
Should add the all libraries in additional dependency list.

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions