In Kali Linux whenever I open a binary in Olly Debugger after compiling the c source file, it gives an error:
"The file is not a valid PE file."
No debugging takes place thereafter. Is there any workaround for this?
gcc complies to the ELF format. PE is for Windows Executable files.
gcc
Use a Linux debugger. Something like gdb is fine.
gdb
Or cross-compile the c file to a Windows one (if that suits your use case)
Linux uses the ELF format for binaries.
Windows uses primarily the PE format.
They are distinct. Olly is made for Windows binaries and does not understand ELF files.
GDB is a good debugger for Linux.