在使用gcc編譯代碼時出現(xiàn)了一個warning,no newline at end of file ,具體原因是因為在文件尾必須的新增一行空行,以避免include文件時,展開后與后面的文件連為一行,造成錯誤。C++文檔中有明確說名。唉,vs就從來沒有提醒過,難道是換行符的區(qū)別?
A source file that is not empty and that does not end in a new-line character, or that ends in a new-line character immediately preceded by a backslash character before any such splicing takes place, shall be processed as if an additional new-line character were appended to the file (C++11 §2.2/1)