I. BACKGROUND
Because Windows and Linux do not have the same identity, code delivery from different systems can cause changes in the code format that could lead to problems with the program failing to compile properly. Therefore, according to some compiled error prompts, you can navigate to a file format problem, you want to convert the program's text file.
Second, the solution
The end of the Windows identity line is a carriage return line feed, which is ' \ r \ n ', also called CRLF. Linux's identification of the end of a line is only a newline, that is, ' \ n ', which is LF. When you copy a program from Windows to Linux, you only need to format all the files using the following command (see [1]).
find . -type f -exec dos2unix {} \;
Third, the method of viewing file type 3.1windows using notepad++, you can set the display of all characters (refer to [2]), notepad++ the lower right corner will show the file type.
Use vim under 3.2linux (reference [3])
Using VIM to open the file, enter: Set FF?. The file type can be based on the returned result
Use gedit under 3.3linux
Use Gedit to open the file and search for ' \ r \ n ' to see if the end of each line exists. The presence is usually a DOS type, and the UNIX type does not exist.
Iv. Reference Documents
[1]linux-dos2unix command on entire directory-stack Overflow
[2]3.10. notepad++ supports display of carriage returns, line breaks, tab keys, beginning of line, end of lines and other special characters
[3] File Format-vim Tips Wiki
How do I see whether a file is in DOS or UNIX format?