I don't understand what my compiler doesn't like. Syntax seems to be all right. Please help me, an incompetent person, find what the error is. The header file is:
#ifndef ADD_H #define ADD_H int add(int &num, struct system *base); #endif #include "add.h" #include <stdio.h> #include <string.h> int add(int &num, struct system *base) { int new = num; printf("Номер видеокасеты: "); scanf("%d", &base[num].number); printf("Название фильма: "); scanf("%s", base[num].name); printf("Страна, где был снят фильм: "); scanf("%s", base[num].country); printf("Продолжительность фильма: "); scanf("%d", &base[num].span); printf("Жанр фильма; "); scanf("%s", base[num].genre); printf("Дата приобретения касеты(через пробел): "); printf("День Месяц Год"); scanf("%d %d %d", &base[num].day, &base[num].mounth, &base[num].year); num++; if(num == new + 1) printf("\nOK!\n"); else printf("\nError\n"); return new; } int main() { struct system base[100]; int num = 0; char name_file[40] = "export.txt"; name_file; int key = 0; while (1) { key = menu(); switch (key) { case 1: add(num, base); break; case 2: clear(num, base); break; default: printf("Error! \n"); break; } } } Displays by mistake in these 2 modules.
clear.h
#ifndef CLEAR_H #define CLEAR_H int clear(int *num, system *base ); #endif add.h
#ifndef ADD_H #define ADD_H int add(int *num, system *base ); #endif There are still 2 errors left ...
cd '/Users/gorbunov/Downloads/Программы/my_kursach' /usr/bin/make -f Makefile CONF=Debug "/Library/Developer/CommandLineTools/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf "/Library/Developer/CommandLineTools/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/my_kursach mkdir -p build/Debug/GNU-MacOSX rm -f "build/Debug/GNU-MacOSX/main.od" gcc -c -g -MMD -MP -MF "build/Debug/GNU-MacOSX/main.od" -o build/Debug/GNU-MacOSX/main.o main.c In file included from main.c:3: ./add.h:3:19: error: unknown type name 'system' int add(int *num, system *base); ^ In file included from main.c:4: ./clear.h:3:21: error: unknown type name 'system' int clear(int *num, system *base ); ^ main.c:11:5: warning: expression result unused [-Wunused-value] name_file; ^~~~~~~~~ 1 warning and 2 errors generated. make[2]: *** [build/Debug/GNU-MacOSX/main.o] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 СОБРАТЬ FAILED (значение выхода 2,, общее время: 375ms)
newis key. Perhaps this is the problem. - pankint &nummean? - 0xdb