Search code examples
c++cvisual-studio-2012warnings

unexpected tokens following preprocessor directive - expected a newline


this is my code.

#include <stdio.h>
#include <stdlib.h>

int main(void) {
int a, b, somma, massimo;
printf("Inserire il primo valore: A =");
scanf_s("%d", a);
printf("Inserire il secondo valore: B =");
scanf_s("%d", b);
if (b > 0) {    //1
    printf("B = %d e positivo", b);
} else {
    printf("B = %d e negativo", b);
}
if (a % 2 == 0){    //2
    printf("A = %d e pari", a);
} else {
    printf("A = %d e dispari", a);
}
somma = a + b;  //3
printf("A + B = %d", somma);
if (a < 0) {    //4
    a = -a;
}
if (b < 0) {
    b = -b;
}
massimo = a + b;
printf("Il numero più grande ottenibile con questi due numeri A, B e %d", massimo);
}

when i try to compile it gives me this warning:

1>c:\users\mario\documents\visual studio 2015\projects\controlla a e b\main.c : error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format

1>c:\users\mario\documents\visual studio 2015\projects\controlla a e b\main.c(1): warning C4067: unexpected tokens following preprocessor directive - expected a newline


Solution

  • Remove all non-ASCII characters from your files or set your editor and compiler to accept UTF-8.