开源项目推荐:POCO C++ Libraries大全,含MFC的编译及使用

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.

 

1、官网

https://pocoproject.org/index.html

https://pocoproject.org/releases/

https://github.com/pocoproject/poco

 

2、教程

https://blog.csdn.net/walk_and_think/article/details/82432863 VS2013安装

https://blog.csdn.net/arau_sh/column/info/poco-cpp-lib

https://blog.csdn.net/m1109048058/article/details/79624709 MFC中引入POCO库之后找不到API的问题

在MFC项目中加入POCO库,导致MFC中的部分方法找不到。 
比如: 

error C3861: “GetObject”: 找不到标识符 

error C3861: “CreateFile”: 找不到标识符

解决办法:

在\Foundation\include\Poco\UnWindows.h文件中的注释部分已经说明。 
方法1、使用对应方法的Unicode变体(e.g., GetUserNameW)和ASCII变体(GetUserNameA
方法2、使用POCO_NO_UNWINDOWS的宏定义
VC++属性页预编译头添加变量:

_CRT_SECURE_NO_WARNINGS
POCO_NO_UNWINDOWS

推荐方法1

另外,多关注一下

\Foundation\include\Poco\Config.h,里面有C++11的开关

// without POCO_WIN32_UTF8 defined on Windows is deprecated.
//#define POCO_WIN32_UTF8
// Define to enable C++11 support
#define POCO_ENABLE_CPP11

\Foundation\include\Poco\Platform_WIN32.h

 

3、我的编译方式

(1)新建空项目

(2)手动添加自己需要的库

 

4、我使用MFC遇到的内存泄露问题:

https://bbs.csdn.net/topics/392663362

我是在MFC使用POCO库的,std:string存在内存泄露,解决方法是:
Build poco with MFC Extension DLLs projects, not the windows DLL, then it can used with VC++/MFC
参考https://github.com/pocoproject/poco/issues/2237

说白了,就是

(1)poco的项目属性页,常规,MFC的使用,选择“在共享 DLL 中使用 MFC”。

(2)poco项目属性页,链接器,输入,附加依赖库,添加Advapi32.lib

Advapi32.lib很重要,否则编译会报错:

1>正在生成代码...
1>  正在创建库 ..\lib\PocoFoundationd.lib 和对象 ..\lib\PocoFoundationd.exp
1>EventLogChannel.obj : error LNK2019: 无法解析的外部符号 __imp__DeregisterEventSource@4,该符号在函数 "public: virtual void __thiscall Poco::EventLogChannel::close(void)" (?close@EventLogChannel@Poco@@UAEXXZ) 中被引用
1>EventLogChannel.obj : error LNK2019: 无法解析的外部符号 __imp__RegisterEventSourceA@8,该符号在函数 "public: virtual void __thiscall Poco::EventLogChannel::open(void)" (?open@EventLogChannel@Poco@@UAEXXZ) 中被引用
1>EventLogChannel.obj : error LNK2019: 无法解析的外部符号 __imp__ReportEventA@36,该符号在函数 "public: virtual void __thiscall Poco::EventLogChannel::log(class Poco::Message const &)" (?log@EventLogChannel@Poco@@UAEXABVMessage@2@@Z) 中被引用
1>EventLogChannel.obj : error LNK2019: 无法解析的外部符号 __imp__RegCloseKey@4,该符号在函数 __catch$??1EventLogChannel@Poco@@MAE@XZ$0 中被引用
1>EventLogChannel.obj : error LNK2019: 无法解析的外部符号 __imp__RegCreateKeyExA@36,该符号在函数 __catch$??1EventLogChannel@Poco@@MAE@XZ$0 中被引用
1>EventLogChannel.obj : error LNK2019: 无法解析的外部符号 __imp__RegSetValueExA@24,该符号在函数 __catch$??1EventLogChannel@Poco@@MAE@XZ$0 中被引用
1>RandomStream.obj : error LNK2019: 无法解析的外部符号 __imp__CryptAcquireContextA@20,该符号在函数 "public: virtual int __thiscall Poco::RandomBuf::readFromDevice(char *,__int64)" (?readFromDevice@RandomBuf@Poco@@UAEHPAD_J@Z) 中被引用
1>RandomStream.obj : error LNK2019: 无法解析的外部符号 __imp__CryptReleaseContext@8,该符号在函数 "public: virtual int __thiscall Poco::RandomBuf::readFromDevice(char *,__int64)" (?readFromDevice@RandomBuf@Poco@@UAEHPAD_J@Z) 中被引用
1>RandomStream.obj : error LNK2019: 无法解析的外部符号 __imp__CryptGenRandom@12,该符号在函数 "public: virtual int __thiscall Poco::RandomBuf::readFromDevice(char *,__int64)" (?readFromDevice@RandomBuf@Poco@@UAEHPAD_J@Z) 中被引用
1>..\bin\PocoFoundationd.dll : fatal error LNK1120: 9 个无法解析的外部命令
1>已完成生成项目“Foundation_vs140.vcxproj”的操作 - 失败。

 

---

题外话:

1、介绍一个国产的C++库:ACL,跨平台,大而全

One advanced C/C++ library for Linux, Mac, FreeBSD, Solaris(x86), Windows, Android, IOS 

https://github.com/acl-dev/acl

https://blog.csdn.net/zsxxsz

https://zsxxsz.iteye.com/

2、C++库大全

https://github.com/fffaraz/awesome-cpp

 

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值