acl-dev / acl

C/C++ server and network library, including coroutine,redis client,http/https/websocket,mqtt, mysql/postgresql/sqlite client with C/C++ for Linux, Android, iOS, MacOS, Windows, etc..
https://acl-dev.cn
GNU Lesser General Public License v3.0
2.88k stars 936 forks source link

vs2022搞出来的静态库为啥用不明白? #284

Closed virginity-is-cool closed 2 years ago

virginity-is-cool commented 2 years ago

我用vs2019和vs2022点vs2019那个sln搞出来的lib_acl_cpp.lib,加上lib_acl.hpp,想移植到windows上玩,编写和编译阶段都没问题,却一直在链接阶段报未定义引用。尝试了动态库,debug版,都这样。请给windows爱好者一点关爱吧求求啦

zhengshuxin commented 2 years ago

图片 上图为使用vs2019编译动态库的选择方法,编译顺序为:lib_acl -> lib_protocol -> lib_acl_cpp,会在 acl/DebugDll/ 目录下生成: lib_acl.lib, lib_acl.dll, lib_protocol.lib, lib_protocol.dll, lib_acl_cpp.lib lib_acl_cpp.dll,当以动态库引入到你的项目中时,需要在VS的预处理部分增加两个宏定义:ACL_CPP_DLL,ACL_DLL,这样可以使 acl 中的 API 导出使用。

virginity-is-cool commented 2 years ago

谢谢你,树先生