компиляция размещенного кода приводит к:
gcc -ggdb -Wall -Wextra -Wconversion -pedantic -std=gnu11 -c "untitled.c" (in directory: /home/richard/Documents/forum)
untitled.c:1:1: error: unknown type name ‘include’
include stdio.h
^~~~~~~
untitled.c:1:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
include stdio.h
^
untitled.c: In function ‘main’:
untitled.c:73:22: warning: implicit declaration of function ‘avgGrayScale’; did you mean ‘avgGrayScaleSmall’? [-Wimplicit-function-declaration]
int averageBigLena = avgGrayScale(&lena);
^~~~~~~~~~~~
avgGrayScaleSmall
untitled.c:73:36: error: ‘lena’ undeclared (first use in this function)
int averageBigLena = avgGrayScale(&lena);
^~~~
untitled.c:73:36: note: each undeclared identifier is reported only once for each function it appears in
untitled.c:75:3: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
printf("Average grayscale big image: %d\n", averageBigLena);
^~~~~~
untitled.c:75:3: warning: incompatible implicit declaration of built-in function ‘printf’
untitled.c:75:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
untitled.c:85:5: error: unknown type name ‘FILE’
FILE *lenaAsciiBig;
^~~~
untitled.c:87:20: warning: implicit declaration of function ‘fopen’ [-Wimplicit-function-declaration]
lenaAsciiBig = fopen("lena_ascii_big.txt", "w");
^~~~~
untitled.c:87:18: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
lenaAsciiBig = fopen("lena_ascii_big.txt", "w");
^
untitled.c:95:13: warning: implicit declaration of function ‘fwrite’ [-Wimplicit-function-declaration]
fwrite(&c, 1, 1, lenaAsciiBig);
^~~~~~
untitled.c:95:13: warning: incompatible implicit declaration of built-in function ‘fwrite’
untitled.c:95:13: note: include ‘<stdio.h>’ or provide a declaration of ‘fwrite’
untitled.c:101:9: warning: incompatible implicit declaration of built-in function ‘fwrite’
fwrite(&c, 1, 1, lenaAsciiBig);
^~~~~~
untitled.c:101:9: note: include ‘<stdio.h>’ or provide a declaration of ‘fwrite’
untitled.c:105:5: warning: implicit declaration of function ‘fclose’ [-Wimplicit-function-declaration]
fclose(lenaAsciiBig);
^~~~~~
Compilation failed.
Давайте начнем с include
операторы должны иметь начальный символ #
.
Во-вторых, имена файлов заголовка системы должныбыть окруженным <
и >
IE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
Примечание: чтобы избежать проблем с форматированием кода, вставьте в каждую строку кода 4 пробела при вставке в вопрос.