[odb-users] MSVC19 link error: LNK2001: Unresolved external symbol
Boris Kolpackov
boris at codesynthesis.com
Tue Jun 25 06:51:48 EDT 2024
CETONI GmbH - Uwe Kindler <uwe.kindler at cetoni.de> writes:
> error LNK2001: Unresolved external symbol ""struct odb::details::share
> odb::details::shared" (?shared at details@odb@@3Ushare at 12@A)"
>
> The symbol is declared in odb/details/shared_ptr/base.hxx:
>
>
> extern LIBODB_EXPORT share shared;
I believe adding -DLIBODB_SHARED to your MSVC compiler command line
when building your application (and generated code) will help.
For background, without either LIBODB_SHARED or LIBODB_STATIC we
fall back to automatic symbol importing but in MSVC it only works
for functions, not global variables (this is the reason why you
only see this unresolved symbol rather than many -- the rest are
all functions and that works).
More information about the odb-users
mailing list