format not a string literal and no format arguments

How is 618 sales champion made?Uncover the secret of e-commerce’s “invigorating” hundreds of millions of sales data>>>

Recently, in the process of compiling the source code of ortp under Linux, we encountered the following problems, and we did not find a good solution on the Internet. However, after some attempts, the problem was finally solved. Here is a note~~~

Error: format not a string literal and no format arguments

The error occurred in the following environment:

Key point: the compiled file contains the following forms of code:


char*pTestStr=”thisisatest!”;

printf(pTestStr);

And when compiling the above code in Ubuntu, it is easy to get compilation errors

Solution:

Change the printf (pteststr) statement to:

printf(“%s”,pTestStr);

My system is Ubuntu 9.10, and the GCC version is 4.4.1, which may be caused by the strict code checking of this GCC version

Concluding remarks

Learn more excellent courses for free and log in to the official website of Lebo college http://www.learnbo.c/

Or follow our official microblog and wechat, there are more surprises~

This article is from “jhuster’s column” blog, please keep this source http://ticktick.blog.51cto.com/823160/311614

Similar Posts: