apache / rocketmq-client-cpp

Apache RocketMQ cpp client
https://rocketmq.apache.org/
Apache License 2.0
358 stars 157 forks source link

vs2019 compile error #445

Open yuntong613 opened 1 year ago

yuntong613 commented 1 year ago

Environment: Windows 10,vs2019,vcpkg and rocketmq master branch. Error Info : There is no "setenv" method in vs2019,but _putenv or _putenv_s

HUHANK commented 1 month ago

@yuntong613 这个问题有解决吗?不修改代码的情况下

yuntong613 commented 1 month ago

在源码\rocketmq-client-cpp\src\common\UtilAll.h 引入自己的头文件,比如名字叫env.h

以下是自己写的env.h内容

include

ifdef WIN32

int setenv( const char name, const char value, int overwrite ) { int errcode = 0; if( !overwrite ) { size_t envsize = 0; errcode = getenv_s( &envsize, NULL, 0, name ); if( errcode || envsize ) return errcode; } return _putenv_s( name, value ); }

endif

HUHANK commented 1 month ago

@yuntong613 hello, 你有详细的VS2019 编译 rocketmq-cpp-client 2.2.0 的说明文档吗?我这边编译遇到问题老是不成功

yuntong613 commented 1 month ago

@HUHANK 工程地址在这里,https://github.com/yuntong613/RocketMQ