Danial Hosseini Danial Hosseini - 3 months ago 11
C Question

C programs are not compiled in my kali linux

my sample.c program:

#include <stdio.h>

int main()
{
printf(“Hello World!\n”);
return 0;
}


so when I want compile it I see this error :

root@Kali:~/Desktop# x86_64-w64-mingw32-gcc sample.c -o file.exe
sample.c: In function ‘main’:
sample.c:5:2: error: stray ‘\342’ in program
sample.c:5:2: error: stray ‘\200’ in program
sample.c:5:2: error: stray ‘\234’ in program
sample.c:5:12: error: ‘Hello’ undeclared (first use in this function)
sample.c:5:12: note: each undeclared identifier is reported only once for each function it appears in
sample.c:5:18: error: expected ‘)’ before ‘World’
sample.c:5:18: error: stray ‘\’ in program
sample.c:5:18: error: stray ‘\342’ in program
sample.c:5:18: error: stray ‘\200’ in program
sample.c:5:18: error: stray ‘\235’ in program


I can't compile any C format file. Please help me.

Answer

This is due to your editor . (quotation marks) and " is different and is causing error . Try with " .

#include <stdio.h>

 int main()
 {
 printf("Hello World!\n");
 return 0;
  } 

Try other code editor.