У меня возникли проблемы с поиском моей ошибки. Вот определение в structures.h
Что в этом плохого? C
typedef struct book {
bank_account_t **accounts;
transaction_t **transactions;
} book_t;
А вот в functions.c
где я включил заголовок и попытаться использовать тип book_t
#include "structures.h"
void load_book(book_t *book) {
}
Но я получаю эту ошибку
functions.c:10:16: error: unknown type name ‘book_t’
void load_book(book_t *book) {
^
редактирует с дополнительным кодом ниже:
В моем main
файл я приказываю мои .h
файлы как так
#include "structures.h"
#include "functions.h"
structures.h
#ifndef STRUCTURES_H
# define STRUCTURES_H
typedef struct bank_account {
char *name;
int amount;
} bank_account_t;
typedef struct transaction {
char *name;
int amount;
} transaction_t;
typedef struct book {
bank_account_t **accounts;
transaction_t **transactions;
} book_t;
#endif
function.c
#include <stdio.h>
#include "functions.h"
#include "structures.h"
#include "bank_account.h"
#include "transaction.h"
void load_book(book_t *book) {
}
void init_book() {
}
bank_account.h
#ifndef BANK_ACCOUNT_H
# define BANK_ACCOUNT_H
void init_new_bank();
void deinit_new_bank();
#endif
transaction.h
#ifndef TRANSACTION_H
# define TRANSACTION_H
#endif
is not book_t действует только в структурах.h? –
очень странный ... есть ли дополнительная информация? как вы строите программу? и, пожалуйста, опубликуйте весь 'structure.h' ... –
Показать всю программу. Когда я скомпилирую его с помощью gcc как файла C, он отлично работает, как и должно быть. Где указаны определения для bank_account и транзакции? – Devolus