简介

遇到问题

unable to find string literal operator ‘operator""format’ with ‘const char [10]’, ‘long unsigned int’ arguments
#define DEBUG_(format,...) printf("[DEBUG] "format"\n", ##__VA_ARGS__)

参考链接

https://blog.csdn.net/q2519008/article/details/80934815

Result

可能是因为C++11或者更高的标准更改了编译操作参考链接

https://en.cppreference.com/w/cpp/language/user_literal

其中" 引号也是一个可以重载的操作符。没有string和long unsigned int结合的操作符。

TODO

#define DEBUG_(format,...) printf("[DEBUG] "format"\n", ##__VA_ARGS__)

替换为宏函数

/*
* @Author: your name
* @Date: 2020-12-02 09:06:35
* @LastEditTime: 2020-12-02 13:59:54
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /my_skel/header/debug.hpp
*/
#ifndef __DEBUG_HPP__
#define __DEBUG_HPP__
#include <cstdio>
#include <string>
#include <iostream> //#define __TT__ // #ifdef __TT__
// #define ERROR_D(...) \
// do{ \
// fprintf(stderr, "[ERROR ]%s %s(Line %d): ",__FILE__,__FUNCTION__,__LINE__); \
// fprintf(stderr, __VA_ARGS__); \
// }while(0)
// #else
// #define ERROR_D(...)
// #endif // #ifdef __TT__
// #define WARNING_D(...) \
// do{ \
// fprintf(stdout, "[WARNING]%s %s(Line %d): ",__FILE__,__FUNCTION__,__LINE__); \
// fprintf(stdout, __VA_ARGS__); \
// }while(0)
// #else
// #define WARNING_D(...)
// #endif // #ifdef __TT__
// #define INFO_D(...) \
// do{ \
// fprintf(stdout, "[INFO ]%s %s(Line %d): ",__FILE__,__FUNCTION__,__LINE__); \
// fprintf(stdout, __VA_ARGS__); \
// }while(0)
// #else
// #define INFO_D(...)
// #endif #ifdef __TT__
#define DBG_D(format,...)\
do{ \
std::string tout_xxdafdsaf="[DEBUG] "; \
tout_xxdafdsaf += (std::string)format; \
printf(tout_xxdafdsaf.c_str(), ##__VA_ARGS__); \
}while(0)
#else
#define DBG_D(format,...) \
do{ \
}while(0)
#endif #ifdef __TT__
#define DBG_S(...)\
do{ \
std::cout << __VA_ARGS__; \
}while(0)
#else
#define DBG_S(...) \
do{ \
}while(0)
#endif // #ifdef __TT__
// #define SHOW_TIME(...) \
// do{\
// extern unsigned long long gLatestTime;\
// timeval tp;\
// gettimeofday(&tp, NULL);\
// unsigned long long now = tp.tv_sec*1000000+tp.tv_usec; \
// if(gLatestTime != 0) \
// { \
// fprintf(stdout, ">>>>>>>>>Used Time: %s[%d], %s: %ld.%ld, %llu ms ", __FILE__, __LINE__, __func__, tp.tv_sec, tp.tv_usec, (now-gLatestTime)/1000);\
// fprintf(stdout, "/n"); \
// } \
// gLatestTime = now;\
// }while(0)
// #else
// #define SHOW_TIME(...)
// #endif #endif

因为宏展开防止出现同名 使用了tout_xxdafdsaf这个

unable to find string literal operator ‘operator""format’ with ‘const char [10]’, ‘long unsigned int’ arguments的更多相关文章

  1. format not a string literal and no format arguments

    今天cocos2d-x打包 android的时候报错:format not a string literal and no format arguments 报错点是:__String::create ...

  2. Android studio2.2 ndk 错误 :format not a string literal and no format arguments!

    在Android Studio2.2 进行NDK编程,在对*char 字符串 进行日志输出时,报错: error: format not a string literal and no format  ...

  3. cocos2dx android版本移植时的Error format not a string literal and no format arguments解决方案

    原文地址 : http://www.cnblogs.com/hhuang2012/p/3336911.html cocos2dx android版本移植时的Error format not a str ...

  4. 生成apk文件遇到的编译问题error: format not a string literal and no format arguments

    编译错误时使用的android-ndk为r9的版本号.报下面错误: "Compile++ thumb : cocosdenshion_static <= SimpleAudioEngi ...

  5. Error format not a string literal and no format arguments解决方案

    原地址: http://blog.csdn.net/joeblackzqq/article/details/25985299 cData.cpp:355:30:error:format not a s ...

  6. error: format not a string literal and no format arguments [-Werror=format-security]

    You can put this in your Application.mk to disable treating those warnings as errors: APP_CFLAGS += ...

  7. Ubuntu gcc编译报错:format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘__time_t’ [-Wformat=]

    平时用的都是Centos系统,今天偶然在Ubuntu下编译了一次代码,发现报错了: 源码: #include <stdio.h> #include <sys/time.h> # ...

  8. const char* && string && String^ 类型转换

    const char* && string && String^ 类型转换 const char* ---> string const char * cw= &q ...

  9. 【转载】char*,const char*和string 三者转换

    本文转自 http://blog.csdn.net/perfumekristy/article/details/7027678 const char* 和string 转换 const char*转换 ...

  10. 转载:string、const char*、 char* 、char[]相互转换

    本文转自:https://blog.csdn.net/rongrongyaofeiqi/article/details/52442169 一:转化总结形式如下: 使用时,要对源格式和目标格式进行初始化 ...

随机推荐

  1. 为什么 Java 新生代被划分为 S0、S1 和 Eden 区?

    为什么 Java 新生代被划分为 S0.S1 和 Eden 区? 在 Java 的 垃圾回收(GC)机制中,新生代 被进一步划分为 Eden 区 和两个 Survivor 区(S0 和 S1).这种划 ...

  2. 聊聊@Autowired与@Resource的区别

    1. 前言 从事过很多家公司,见过很多项目,发现@Autowired和@Resource的使用都是一样的乱, 一个项目中有使用@Autowired的,有使用@Resource的, 甚至有的类中一会儿使 ...

  3. Dynamic adaptation to application sizes (DATAS) GC 策略

    现在大家的 .NET 程序基本都部署在如 K8S 这种容器化场景下.出于节约资源的考虑,往往我们还会限制每个实例占用的资源.不知道大家发现没有,在一些高并发的场景下,我们的程序会占用非常多的内存,内存 ...

  4. 代码随想录第十六天 | Leecode 513. 找树左下角的值、112. 路径总和、113. 路径总和 II、106. 从中序与后序遍历序列构造二叉树

    Leecode 513. 找树左下角的值 题目描述 给定一个二叉树的 根节点 root,请找出该二叉树的 最底层 最左边 节点的值. 假设二叉树中至少有一个节点. 示例 1: 输入: root = [ ...

  5. 【经验】WakeUp、Outlook、Google日历导入飞书日历

    以飞书团队账号登录时,设置的日历就能被团队其他成员看到(可选择私密.仅忙碌[默认].完全公开三种模式),以便相互查看空闲时间. Wakeup日历导出到Outlook日历 Wakeup支持从各大学校便利 ...

  6. SQL 强化练习 (七)

    继续 sql 练习, 不能停下来的哦, 通过这一系列的搬砖操作, 相信在日常业务的sql 应该是能达到相对清楚地写出来的, 尤其是我做数据分析这块, 感觉真的每天都要写才行, 之前都是用 Python ...

  7. 基于onnxruntime结合PyQt快速搭建视觉原型Demo

      我在日常工作中经常使用PyQt和onnxruntime来快速生产demo软件,用于展示和测试,这里,我将以Yolov12为例,展示一下我的方案.   首先我们需要使用Yolov12训练一个模型,并 ...

  8. Flutter开发的高效图片压缩工具:让APP更加丝滑

    @charset "UTF-8"; .markdown-body { line-height: 1.75; font-weight: 400; font-size: 15px; o ...

  9. 探秘Transformer系列之(33)--- DeepSeek MTP

    探秘 Transformer系列之(33)--- DeepSeek MTP 目录 探秘 Transformer系列之(33)--- DeepSeek MTP 0x00 概述 0x01 EAGLE 1. ...

  10. CUDA:页锁定内存(pinned memory)和按页分配内存(pageable memory )

    CUDA架构而言,主机端的内存分为两种,一种是可分页内存(pageable memroy), 一种是页锁定内存(page-lock或 pinned). 可分页内存是由操作系统API malloc()在 ...