[odb-users] MSVC19 link error: LNK2001: Unresolved external symbol
CETONI GmbH - Uwe Kindler
uwe.kindler at cetoni.de
Mon May 27 09:51:15 EDT 2024
Hi,
We use orm-odb now since some years with MinGW compiler on Windows. Now
we decided to switch from MinGW to MSVC19 compiler from Microsoft. Whe
could successfully build the ORM odb libraries following the
instructions from here:
https://codesynthesis.com/products/odb/doc/install-build2.xhtml#windows-odb
Now, when we link our shared library that uses ODB and that implements
the databse classes, we see the following linker error:
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:
namespace odb
{
namespace details
{
struct share
{
explicit
share (char id);
bool
operator== (share) const;
private:
char id_;
};
extern LIBODB_EXPORT share shared;
extern LIBODB_EXPORT share exclusive;
}
}
For me it looks like although the symbols are labeled properly with
LIBODB_EXPORT, they are not exported properly from the DLL. The same
code works fine with MinGW, because MinGW exports all symbols. I have no
real idea, how to solve this issue. Has someone an idea, how this can be
solved? Is this an ODB issue or an MSVC compiler issue - or maybe I'm
doing something wrong:
Environment:
libodb-2.5.0-b.25
MSVC version: 19.29.30154 for 64 bit
Qt Version: 6.5.2
Compiler invocation:
cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline
-Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus
-Zc:externConstexpr -wd4251 -wd4996 -wd4661 -wd4244 /utf-8 -Zi -MDd
-std:c++17 -w34100 -w34189 -w44456 -w44457 -w44458 -wd4577 -wd4467 -W2
-W2 -W2 -W2 -EHsc /Fddebug\qtlabb_itemsd.vc.pdb -DUNICODE -D_UNICODE
-DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DX64
-D_HAS_AUTO_PTR_ETC=1 -DBOOST_ALL_NO_LIB -DNOMINMAX -D_HAS_STD_BYTE=1
-DDEBUG -DUSL_QT -DADVANCED_DOCKING -DQT_QML_DEBUG -DQT_WIDGETS_LIB
-DQT_STATEMACHINE_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -D_WINDL
Thank you for any help.
More information about the odb-users
mailing list