I created a small application using CUDA on Windows. Then I tried porting it to Linux. Suddenly my *.cu file did not compile with the following error:
kernelold.cu(1): error: unrecognized token
kernelold.cu(1): error: expected a declaration
kernelold.cu(1): error: unrecognized token
kernelold.cu(1): error: unrecognized token
At end of source: warning: parsing restarts here after previous syntax error
4 errors detected in the compilation of "/tmp/tmpxft_00002288_00000000-4_kernelold.cpp1.ii".
Out of desperation I wrote the file again under Linux and it suddenly compiled. Now I had two “exactly” the same files and one compiled on Linux, while the other did not.
Finally I looked at both files using a hex editor and found the cause.
The file created under windows began with: EF BB BF
Such a file gives the cryptic compilation error mentioned above, when compiling under Linux.
EF BB BF is the Byte Order Mark, which definitely should not cause such an error.