If you want to save information about the compiler in your executable, use the -sox (Linux* OS) or /Qsox (Windows* OS) option. When you use this option, the following information is saved:
On Linux OS:
To view the information stored in string format in the object file, use the following command:
strings -a a.out|grep comment:
On Windows OS:
To view the linker directives stored in string format in the object file, use the following command:
link /dump /directives filename.obj
The -?comment linker directive displays the compiler version information.
To search your executable for compiler information, use the following command:
findstr "Compiler" filename.exe
This searches for any strings that have the substring "Compiler" in them.