C语言编写宏定义时遇到的编译问题

    我们在项目开发编码的时候,定义宏后编译会报错如下:backslash and newline separated by space [-Werror],

后来经过google搜索,发现是宏定义的“\”连接符后面多了多余的空格,去掉后编译错误消除。

#define desay_debug(_string,myValue) \  
    do{\  
         c_snprintf(desay_info, \  
                  250 - 1, \  
                  "\ndesay: File: %s  Line#: %d  Func: %s()\n !!!:message is %s value is %d\n", \  
                  __FILE__, \  
                  __LINE__, \  
                  __func__, \  
                  _string, \  
                  myValue); \  
        desayEvent.ui4_msg_id=DESAY_MESSAGE_ID;\  
        desayEvent.ui4_data1=(UINT32)&desay_info[0];\  
        a_am_get_app_handle_from_name(&h_app_desay,"homepage");\  
        c_app_send_msg(h_app_desay,0,&desayEvent,sizeof(DESAY_MSG_T),NULL,NULL);\  
    }while(0)  

猜你喜欢

转载自blog.csdn.net/yangrendong/article/details/89089045
今日推荐