0

I think I have a cirular dependance in my code, but I can't find any solution to solve it despite mutliple solutions.

data.h:

#ifndef __DATA_H__
#define __DATA_H__

#include "task_data.h"
#include "parallel_data.h"

typedef union data
{
    task_data_t *task_data;
    parallel_data_t *parallel_data;
} data_t;

#endif

task_data.h:

#ifndef __TASK_DATA_H__
#define __TASK_DATA_H__

#include <stdlib.h>
typedef struct task_data task_data_t;

#include "data.h"
#include "parallel_data.h"

#ifndef MAX_CHILDREN_TASK
#define MAX_CHILDREN_TASK 100
#endif

struct task_data
{
    unsigned long node_id;
    unsigned long id;
    double clock_begin;
    double clock_end;
    size_t children_nb;

    parallel_data_t *parallel_region;
    data_t parent;
    data_t children[MAX_CHILDREN_TASK];
};

// Function signatures

#endif

This code conduce to a compilation error: in task_data_t, the struc doesn't know the type data_t "unknown type name data_t". The problem is the same with parallel_data_t but the solution will be the same for both.

Can someone help me ? Thanks

DevSolar
  • 63,860
  • 19
  • 125
  • 201
Auloma
  • 59
  • 4

0 Answers0