流程:
从github下载libtomcrypt,解压它,使用vs2015打开libtomcrypt_VS2008.sln,然后重新生成项目,得到lib静态库。
得到了lib库,就能直接在自己的项目中使用了,具体使用方式可以参考解决方案2。
问题1:
报错:
the LTC_FAST hack is only available on compilers that support attribute((may_alias)) - disable it for your compiler, and dont worry, it won`t buy you much anyway
解决方案1:
编译器不支持LTC_FAST,那就在tomcrypt_cfg.h中找到LTC_FAST的define,都替换成LTC_NO_FAST。
问题2:
解决方案2:
缺少相应的头文件,说明libtomcrypt中没有数学处理的函数包,则从github下载tommath,通过vs2015编译生成lib静态库,然后在libtomcrypt项目中加入该静态库,需要配置vc++目录,如下:
其中包含目录为头文件所在的目录,库目录为lib所在目录,接着在库管理器中,附加依赖项中添加该lib,如下:
注意:
如果是在实际项目中引用lib,附加依赖项在链接器→输入目录下,如下: