Привет, я работаю над заданием, в котором мне нужно обработать некоторые изображения (изменить их размер) с помощью pthreads.
Это содержимое имени файла .h
typedef struct {
int type;
int width;
int height;
int max_value;
int *input;
int *output;
}image;
typedef struct {
int id; // thread id
image *in; //input image
image *out; // output image
}ptf_arguments;
И этосодержимое файла filename.c
void resize(image *in, image * out) {
int i;
// printf("Type is %d. We have width = %d and height = %d. Max value is %d\n", in->type, in->width, in->height, in->max_value);
pthread_t tid[num_threads];
struct ptf_arguments arguments[num_threads]; // <- HERE
for(i = 0 ; i < num_threads; i++) {
arguments[i].id = i;
arguments[i].in = in;
arguments[i].out = out;
}
printf("First thread should have id = %d. In image of (%d)\n", args[0].id, arguments[0].in.width);
for(i = 0 ; i < num_threads; i++) {
//pthread_create(&(tid[i]), NULL, resize_thread_function, &(args[i]));
}
}
Я получаю эту ошибку:
error: array type has incomplete element type ‘struct ptf_arguments’
struct ptf_arguments arguments[num_threads];
в строке, отмеченной комментарием <- ЗДЕСЬ, команда компиляции: </p>
gcc -o filename filname.c -lpthread -Wall -lm
Что происходит и как я могу это исправить?Спасибо
РЕДАКТИРОВАТЬ 1: Да, я сделал #include "filename.h"