Closed tomika closed 3 years ago
If I comment out all refernces to absl::GetFlag from time_limit.h, the problem disappers. Should I download another library file? I've only found ortools.lib in the package, which is linked.
I suppose you are not compiling with c++17 enabled. Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00
Le mer. 13 janv. 2021 à 17:55, tomika notifications@github.com a écrit :
If I comment out all refernces to absl::GetFlag from time_limit.h, the problem disappers. Should I download another library file? I've only found ortools.lib in the package, which is linked.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/2334#issuecomment-759581065, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPL3MWJMZG7X2C72KJNU3SZXF6TANCNFSM4WBCVIJQ .
You're right: If I define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING it compiles successfully. Without these defines it doesn't compile:
1>c:\MSDev\or-tools_VisualStudio2019-64bit_v8.1.8487\include\absl\memory\memory.h(355,1): error C4996: 'std::allocator<std::pair<const K,V>>::rebind': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
Version: v8.1.8487 Language: C++ Windows 10 Pro
I wrote a CP-Sat solver and wanted to use TimeLimit as suggested in documentation.
Since then I got "unresolved external" linker errors. If I comment out line with
model.GetOrCreate<TimeLimit>()
the program compiles successfully.
The problem is reproducable with example code here: https://github.com/google/or-tools/blob/master/ortools/sat/doc/solver.md#c-code-4
Commenting out line
model.GetOrCreate<TimeLimit>()->RegisterExternalBooleanAsLimit(&stopped);
the program compiles, but keeping it in the result:
1>Source.obj : error LNK2001: unresolved external symbol "private: virtual bool cdecl absl::lts_2020_09_23::flags_internal::FlagImpl::ParseFrom(class absl::lts_2020_09_23::string_view,enum absl::lts_2020_09_23::flags_internal::FlagSettingMode,enum absl::lts_2020_09_23::flags_internal::ValueSource,class std::basic_string<char,struct std::char_traits,class std::allocator > &)" (?ParseFrom@FlagImpl@flags_internal@lts_2020_09_23@absl@@EEAA_NVstring_view@34@W4FlagSettingMode@234@W4ValueSource@234@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "private: virtual bool cdecl absl::lts_2020_09_23::flags_internal::FlagImpl::ValidateInputValue(class absl::lts_2020_09_23::string_view)const " (?ValidateInputValue@FlagImpl@flags_internal@lts_2020_09_23@absl@@EEBA_NVstring_view@34@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "private: virtual class absl::lts_2020_09_23::string_view __cdecl absl::lts_2020_09_23::flags_internal::FlagImpl::Name(void)const " (?Name@FlagImpl@flags_internal@lts_2020_09_23@absl@@EEBA?AVstring_view@34@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "bool __cdecl absl::lts_2020_09_23::flags_internal::AbslParseFlag(class absl::lts_2020_09_23::string_view,bool ,class std::basic_string<char,struct std::char_traits,class std::allocator > )" (?AbslParseFlag@flags_internal@lts_2020_09_23@absl@@YA_NVstring_view@23@PEA_NPEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
Thanks for the help in advance.