❌ 错误的写法
std::string response = "LOG_OK: 日志已记录 [" +  // const char[] 
                      (level == LogLevel::DEBUG ? "DEBUG" : "INFO") + // const char*
                      "] " + log_content + "\n";
✅ 正确的写法
std::string response = std::string("LOG_OK: 日志已记录 [") +  // 显式转换为std::string
                      (level == LogLevel::DEBUG ? "DEBUG" : "INFO") + // const char*
                      "] " + log_content + "\n";
Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐