Format not a string literal and no format arguments

Source: Internet
Author: User

From: http://ticktick.blog.51cto.com/823160/311614

I recently encountered the following problems during ortp source code compilation in Linux, but I did not find a good solution on the Internet. However, after some attempts, the problem was finally solved, take a note here ~~~

Compilation error: Error: format not a string literal and no format arguments

Environment where the error is generated:

Key point: the compiled file contains the following code:
Char * pteststr = "this is a test! ";
 
Printf (pteststr );

In addition, compilation errors often occur when the above Code is compiled in Ubuntu.

Solution:

Change the printf (pteststr) statement:

Printf ("% s", pteststr );

My system is Ubuntu 9.10 and GCC is 4.4.1, which may be caused by strict code check.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.