I was working on a C program in linux, and realized C++ would be a better fit. So I copied the program and gave it the .cpp extension. then I spent a bunch of time figuring out all the weird errors i was getting, before realizing the file retained the build commands from gcc.
The program has the same file name, only the extension had changed. new files with different filenames did not have this issue.