GCC compilation error: the program has a free '\ 000000' \ 000000' \ 000000' and so on.

Source: Internet
Author: User
There are two main causes:
1. The Program (*. C, *. h) uses Chinese Punctuation Marks (full angle), such as;,}, +.
Change it to the punctuation marks in English.
Sometimes, a similar error occurs when a space is deleted and entered again.
It is quite easy to replace it in vim.

How can I see the error message?
Od-C hello. c> log.txt
You can see the symbol in the log.

2.
If an error occurs when an English Punctuation Mark is replaced, the file storage format is incorrect.
Generally in Windows files are stored in ANSI format, in order to be universal in Linux, it is recommended to save as a UTF-8 without BOM
Encoding format, because GCC and G ++ currently do not support BOM encoding format for UTF-8.

What should I do if I encounter a UTF-8 BOM error when compiling with G ++?
$ G ++-I.../../include unit_test.cpp-O unit_test
Unit_test.cpp: 1: Error: The program has a free '\ 357'
Unit_test.cpp: 1: Error: The program has a free '\ 273'
Unit_test.cpp: 1: Error: The program has a free '\ 277'
In file encoded ded from unit_test.cpp: 63:
...

Or in the English system:
$ G ++-I.../../include unit_test.cpp-O unit_test
Unit_test.cpp: 1: Error: stray '\ 357' in program
Unit_test.cpp: 1: Error: stray '\ 273' in program
Unit_test.cpp: 1: Error: stray '\ 277' in program
In file encoded ded from unit_test.cpp: 63:
...

How do I determine if a file is stored using a UTF-8 Bom?

Run the following command:
$ Cat CPP/src/unit_test/unit_test.cpp | HD-N 10
00000000 ef bb bf 2f 2a 2a 2a 2a 2a |.../****** |
0000000a

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.