Code:
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
int
main(int argc; char *argv[])
{
int i = atoi(argv[1]);
if (argc != 2 || i < 1)
{
printf("You must enter only 1 argument, it must be a positive integer.");
return 1;
}
}
I'm running Fedora and compiling with gcc. I get these errors when compiling:
gcc -ggdb -std=c99 -Wall -Werror ceasar.c -lcrypt -lcs50 -lm -o ceasar
ceasar.c:6:10: error: parameter 'argc' has just a forward declaration
ceasar.c:6:1: error: first argument of 'main' should be 'int' [-Werror=main]
ceasar.c:6:1: error: 'main' takes only zero or two arguments [-Werror=main]
ceasar.c: In function 'main':
ceasar.c:9:9: error: 'argc' undeclared (first use in this function)
ceasar.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
make: *** [ceasar] Error 1