[GiNaC-devel] MSVC error 2766
Jan Rheinländer
jrheinlaender at gmx.de
Sun Feb 13 21:39:54 CET 2022
Hi,
when compiling GiNaC (latest version from git master) with MSVC
(19.29.30139 for x64) it stumbles over the following code in lst.h/lst.cpp:
lst.h line 35:
template<> registered_class_info lst::reg_info;
lst.cpp line 28:
template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic,
print_func<print_context>(&lst::do_print).
print_func<print_tree>(&lst::do_print_tree))
and says:
lst.cpp(28): error C2766: explicit specialization; 'reg_info' has
already been defined
exprseq.h/.cpp has the same issue.
A solution seems to be to remove the code in lst.cpp and replace the
code in lst.h with it. That is
lst.h:
template <> GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic,
print_func<print_context>(&lst::do_print).
print_func<print_tree>(&lst::do_print_tree))
This compiles fine and all checks pass, but it does seem wrong to have
the GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T in a header file.
What is the right way to deal with this error?
Thanks,
Jan Rheinländer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20220213/3c9b2b98/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20220213/3c9b2b98/attachment.sig>
More information about the GiNaC-devel
mailing list