c++ - Qt - 获取 "warning: format not a string literal and no format arguments"

标签 c++ qt warnings qt-creator literals

在这样的行上不断收到警告

qDebug("An error occured while trying to create folder " + workdir.toAscii());

workdir 是 QString()

warning: format not a string literal and no format arguments

最佳答案

大概应该是:

qDebug("An error occured while trying to create folder %s", workdir.constData());

qDebugconst char* 作为第一个参数。

关于c++ - Qt - 获取 "warning: format not a string literal and no format arguments",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4280697/

相关文章:

android - 在 Qt QMake 中选择 Android API 级别

php - 使用 GET 和 POST 在 PHP 中 undefined index

c - 指针算术 : warning: assignment makes pointer from integer without a cast [enabled by default]

macos - Qt Mac 应用程序无法创建自包含 App Bundle (Qt Creator Build)

python - 如何在 QTabWidget 中设置背景颜色/图像特定选项卡?

objective-c - 如何处理 Xcode 警告 "no previous prototype for function..."?

c++ - C++中字符串实现的二叉搜索树

C++堆排序困惑

c++ - 将 pcm 转换为 mp3(使用 LAME)导致 mp3 文件中出现 "clicks"

C++ 处理非常大的整数