kyubotics / cqcppsdk Goto Github PK
View Code? Open in Web Editor NEWA C++ SDK for CoolQ.
Home Page: https://cqcppsdk.netlify.app/
License: MIT License
A C++ SDK for CoolQ.
Home Page: https://cqcppsdk.netlify.app/
License: MIT License
std::string get_app_directory() {
print_api_call("get_app_directory");
const auto app_dir = fs::u8path(get_coolq_root_directory()) / "data" / "app" / "";
dir::create_dir_if_not_exists(app_dir.u8string());
return app_dir.u8string();
}
std::string get_coolq_root_directory() {
print_api_call("get_coolq_root_directory");
string root_dir = FAKE_COOLQ_ROOT_DIR;
dir::create_dir_if_not_exists(root_dir);
return fs::absolute(fs::u8path(root_dir)).u8string();
}
数据是直接走腾讯服务器还是走CQ的服务器?
RT,我翻了一下 event.h 等文件似乎没有找到。
一开始文件还可以生成,但是在我加了几行代码后显示event.h
出现各种错误。我重新下载了cqcppsdk
的所有文件并放入extern
文件夹,还是显示同样的报错。
更改后的头文件:
#include<iostream>
#include<set>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<urlmon.h>
#include<string>
#include<fstream>
#include<cqcppsdk/cqcppsdk.h>
#pragma comment(lib,"urlmon.lib")
主要是这部分
在MinGW里不需要这个 __pragma(comment(linker, ...))
还有 CMake 里针对MinGW 需要添加几个flags -static -Wl,--kill-at,--enable-stdcall-fixup
When trying to run cmake build
, I got the follwing error:
[build] In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\filesystem:37,
[build] from E:\awesome-bot\extern\cqcppsdk\src\dev_mode\api.cpp:5:
[build] c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)':
[build] c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path')
[build] || (__p.has_root_name() && __p.root_name() != root_name()))
[build] ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
[build] In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iosfwd:40,
[build] from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\system_error:40,
[build] from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\fs_fwd.h:35,
[build] from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\filesystem:36,
[build] from E:\awesome-bot\extern\cqcppsdk\src\dev_mode\api.cpp:5:
[build] c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\postypes.h:221:5: note: candidate: 'template<class _StateT> bool std::operator!=(const std::fpos<_StateT>&, const std::fpos<_StateT>&)'
[build] operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
[build] ^~~~~~~~
You may access the full output file here.
I am using Visual Studio Code and MinGW g++ 8.2.0
as my compiler.
环境:MinGW GCC9.2.0
、CMake3.16.3
VSCode插件:CMake Tools1.3.1
选用 GCC for mingw32 9.2.0
工具包后,可正常配置文件夹,而在生成时出现如下错误:
[build] D:\BOT\extern\cqcppsdk\src\dev_mode\main.cpp: In function 'int main()':
[build] D:\BOT\extern\cqcppsdk\src\dev_mode\main.cpp:71:30: error: '_O_WTEXT' was not declared in this scope; did you mean 'O_TEXT'?
[build] 71 | _setmode(_fileno(stdin), _O_WTEXT);
[build] | ^~~~~~~~
[build] | O_TEXT
[build] CMakeFiles\app_dev.dir\build.make:90: recipe for target 'CMakeFiles/app_dev.dir/extern/cqcppsdk/src/dev_mode/main.cpp.obj' failed
[build] mingw32-make.exe[2]: *** [CMakeFiles/app_dev.dir/extern/cqcppsdk/src/dev_mode/main.cpp.obj] Error 1
[build] CMakeFiles\Makefile2:123: recipe for target 'CMakeFiles/app_dev.dir/all' failed
[build] mingw32-make.exe[1]: *** [CMakeFiles/app_dev.dir/all] Error 2
[build] Makefile:128: recipe for target 'all' failed
[build] mingw32-make.exe: *** [all] Error 2
[build] 生成已完成,退出代码为 2
报错处源代码:
#ifdef WIN32
// 保存当前控制台代码页
old_code_page = GetConsoleCP();
// 设置控制台代码页为 UTF-8
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
// 设置读取模式为宽字符
_setmode(_fileno(stdin), _O_WTEXT);
#endif
将 _O_WTEXT
改为 _O_TEXT
即可正常生成,这是否会影响正常工作?以及报错原因是什么?
user结构体里没有,只看到群成员有这个信息。
macOS使用mingw i686跨平台编译demo通过
按照SDK上的,在macOS上装了一个vcpkg然后想指定triplet 为x86-windows-static-md(似乎要求的动态CRT配置在vcpkg中自带了)
但是在安装库的时候出现了错误Cannot build windows triplets from non-windows.
vcpkg是否无法跨平台编译?还是需要额外的步骤指示vcpkg识别mingw工具链?
看到示例中大量使用了 dolores namespace 中的函数,但在文档中没有看到与此相关的介绍,希望得到科普
RT
1. 取群成员信息,如果失败跳到第四步
2. 如果群名片不为空,返回群名片
3. 返回昵称
4. 取陌生人信息,如果失败跳到第六步
5. 返回昵称
6. 返回QQ号形成的字符串
大佬,有没有纯c语言版本的sdk!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.