(UTF-8 BOM format produces compilation errors) Solution

Source: Internet
Author: User
Tags ocaml


Original Works. reposted for the source! And keep the hyperlink!

The following error occurs when I recently used an older arm-Linux-GCC 4.1.2 to compile a newer Linux kernel:

Xxx. C: 1: Error: The program has a free '\ 357'
XXX: 1: Error: The program has a free '\ 273'
Xxx. C: 1: Error: The program has a free '\ 277'

This is because the file is stored in the form of a UTF-8 Bom, And the compiler used does not support this format.

Run the following command to check whether the XXX. c file is in UTF-8 BOM format:

$ Cat XXX. c | HD-N 10

The output is as follows:

00000000 ef bb bf 2f 2a 0a 20 2a 20 53 |.../*. * s |
0000000a

The first three codes of the output are ef bb bf, indicating that the file is in UTF-8 BOM format.

How to remove the UTF-8 BOM format?

Solution:

Download the bomstrip tool,

Download Page: http://www.ueber.net/who/mjl/projects/bomstrip/

Latest bomstrip-9: bomstrip-9.tgz

Installation and usage (in ubuntu11.04 ):,

Sudo apt-Get install ocaml

Tar zxvf bomstrip-9.tgz

CD bomstrip-9/

Sudo CP bomstrip. ocaml/usr/bin/

Sudo chmod 777/usr/bin/bomstrip. ocaml

Usage:

Ocaml/usr/bin/bomstrip. ocaml <input_file.c> output_file.c

Input_file.c is the original UTF-8 BOM format file, output_file.c is to remove the UTF-8 BOM format file.

Other Instructions:

Ocaml isOcaml language parser;

The bomstrip. ocaml file isThe bomstrip-9 is written in the ocaml language, among which there are other language scripts, I did not test one by one;

Bomstrip usage, how to use bomstrip, UTF-8 BOM error Solution

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.