Repository navigation
Troubleshooting
508364 edited this page Jun 7, 2026
·
3 revisions
常见问题与解决方案。
问题:
CMake Error: Could not find generator "Visual Studio 17 2022"
解决方案: 确保安装了 Visual Studio 2022 并包含 "使用 C++ 的桌面开发" 工作负载。
问题:
bind failed: Address already in use
解决方案: 检查端口 8080 是否被其他程序占用:
netstat -ano | findstr :8080终止占用端口的进程或使用其他端口。
问题:
warning C4476: "snprintf": 格式说明符中的类型字段字符 ";" 未知
解决方案:
确保在嵌入 HTML/CSS 的字符串中正确转义百分号 % 为 %%。
问题:
error: implicit declaration of function 'realpath'
解决方案:
确保在代码文件顶部定义 _GNU_SOURCE:
#define _GNU_SOURCE
#include <stdlib.h>问题:
fatal error: sys/socket.h: No such file or directory
解决方案: 安装 build-essential:
sudo apt install build-essential问题:
warning: unused parameter 'user_data'
解决方案:
添加 (void) 显式忽略:
(void)user_data;检查清单:
- 确认服务器正在运行
- 检查防火墙设置
- 确认监听地址是
0.0.0.0或正确的网络接口 - 检查是否有其他程序占用了端口
可能原因:
- 路径不匹配
- 缺少 Sec-WebSocket-Key
- 网络代理干扰
常见问题:
- 缺少引号
- 尾随逗号
- 注释(标准 JSON 不支持注释)
优化建议:
- 减少日志级别
- 使用连接池
- 启用 HTTP/2 多路复用
- 检查是否有死循环
排查方法:
- 确保所有
nl_create_*都有对应的nl_destroy_* - 检查 JSON/TOML 对象是否正确释放
- 使用工具如 Valgrind (Linux) 或 Dr. Memory (Windows)
如果问题仍然存在:
- 查看项目 GitHub Issues
- 搜索是否有类似问题已解决
- 创建新 Issue 时请提供:
- 操作系统版本
- 编译器版本
- 完整的错误日志
- 最小可复现代码
许可声明 / License Notice 本仓库基于 MIT 协议开源。如果您使用了本项目,请保留原作者署名并附带 LICENSE 文件
This repository is open-sourced under the MIT License. If you use this project, please retain the original author's attribution and include the LICENSE file.
- Auto-complete - 自动补全charset和Vue引入
- Auto-route - 自动路由建议
- ErrorPage - 自定义错误页面模板
- IPC - 进程间通讯服务
- LinkAgg - 同端口链路聚合
- Lang - 多语言错误消息
- Vue - Vue.js后端支持
- Extension - 扩展库开发指南
- TLS - TLS/SSL 加密扩展
- MQTT - MQTT v5.0 协议客户端
- MQTT-Server - MQTT v5.0 协议服务端(Broker)
作者: 508364
版本: 2.4.2
许可: MIT License