Discussion:
[cryptopp-users] Crypto++ 7.0: Warning LNK4221 in project cryptlib with Visual Studio 2015
Don-Umbro
2018-07-10 09:04:40 UTC
Permalink
Hello together,

I'm a new user of the Crypto++ library and just downloaded it about a week
ago.
I got the library integrated into our project and it's working fine.
Thank's to everyone who contributed to this great work.
I'm working on a Win7 64 bit and with Visual Studio 2015.

However I'm a little irritated, because I get LNK4221 error in project
cryptlib even for the original solution cryptest which is shipped with the
strciphr.obj : warning LNK4221: This object file does not define any
previously undefined public symbols, so it will not be used by any link
operation that consumes this library [c:\cryptopp\cryptlib.vcxproj]
I get this warnings for object files strciphr.obj, simple.obj, polynomi.obj
and algebra.obj.

Looking into these files, I figured that these files consist of definitions
/ implementations for member functions of template classes. What's the
point here? From my understanding templates should in general either be in
a header file or be have an explicit instansiation inside the cpp.
https://isocpp.org/wiki/faq/templates#templates-defn-vs-decl also discusses
this topic, mentioning that my understanding contains some
"simplification". So maybe I miss a relevant point here.

simple.cpp does not contain anything at all. oO

What's the point of theses files, do I need them at all?
Can/Should I disable these warnings?
What would be the best way to archive this?
And shouldn't this solution be applied to the public project and not only
locally in my project?

I also found this discussion, which mentions LNK4221:
https://groups.google.com/d/msg/cryptopp-users/Rn1EOAHnfOk/9rHtbelL2kwJ
However it did not help me regarding my uncertainess...

Regards,
Jan

PS: I also get the warning C4456 for declaration of variable "block" in
aria.cpp in lines 151 and 156. Do I get the intention of the code wrong, or
would it be enought to just rename these variables to something like
"blockTemp"?
--
You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jeffrey Walton
2018-07-10 09:24:24 UTC
Permalink
Post by Don-Umbro
...
However I'm a little irritated, because I get LNK4221 error in project
cryptlib even for the original solution cryptest which is shipped with the
Patches are always welcomed.

We don't bust balls over the trivial stuff like formatting. If you can
move the library forward then we are happy to evaluate it.
Post by Don-Umbro
strciphr.obj : warning LNK4221: This object file does not define any
previously undefined public symbols, so it will not be used by any link
operation that consumes this library [c:\cryptopp\cryptlib.vcxproj]
I get this warnings for object files strciphr.obj, simple.obj, polynomi.obj
and algebra.obj.
Try:

* https://github.com/weidai11/cryptopp/commit/3dcceb55f57c
* https://github.com/weidai11/cryptopp/commit/0cee6f01f010

Jeff
--
You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Don-Umbro
2018-07-11 07:24:45 UTC
Permalink
Hi Jeff,

thanks for your answer.

Patches are always welcomed.
Post by Jeffrey Walton
We don't bust balls over the trivial stuff like formatting. If you can
move the library forward then we are happy to evaluate it.
I'm happy to provide a patch / pull request, if I have a solution that
benefits the project. However I'm not as experienced with Crypto++,
cryptography and c++ in general as many of you probably are. So spamming
bad / inappropriate patches onto the project might not be the best...
That's why I wanted to get my understanding right and some comments first.

Looking into the issue a little more, I figured that the corresponding
*.cpp files themselves are included elsewhere. Basically e.g. "algebra.cpp"
in fact seems to be more like a header than a source. One way to get rid of
the issue would be renaming "algebra.cpp" to something like
"algebra_impl.h". Would you view this as a useful change? Why is it a cpp
after all?
Post by Jeffrey Walton
* https://github.com/weidai11/cryptopp/commit/3dcceb55f57c
* https://github.com/weidai11/cryptopp/commit/0cee6f01f010
This solution would work as well. However IMHO it looks more like a
workaround than solving the original issue, which is VisualStudio compiling
algebra.cpp because it is a cpp...

Jan
--
You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jeffrey Walton
2018-08-13 11:29:23 UTC
Permalink
Post by Don-Umbro
...
Looking into the issue a little more, I figured that the corresponding
*.cpp files themselves are included elsewhere. Basically e.g. "algebra.cpp"
in fact seems to be more like a header than a source. One way to get rid of
the issue would be renaming "algebra.cpp" to something like
"algebra_impl.h". Would you view this as a useful change? Why is it a cpp
after all?
Post by Jeffrey Walton
* https://github.com/weidai11/cryptopp/commit/3dcceb55f57c
* https://github.com/weidai11/cryptopp/commit/0cee6f01f010
This solution would work as well. However IMHO it looks more like a
workaround than solving the original issue, which is VisualStudio compiling
algebra.cpp because it is a cpp...
We also have to clear the warnings when using libtool on Unix and Linux.

Jeff
--
You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...