c - #include does not see the function definition -
i have .c , .h file:
misc.c
#include "misc.h" int isallzeros(int *arr, int l) { int i; int allzeros = 1; (i = 0; i<l; i++) { if(arr[i]) { allzeros = 0; break; } } return allzeros; } int containsdup(int *arr1, int *arr2, int l1,int l2) { int i,k; int dup = 0; (i = 0; i<l1; i++) { (k=0;k<l2;k++) { if(arr1[i] == arr2[k]) { dup = 1; break; } } if (dup) break; } return dup; }
and misc.h
#ifndef misc_h #define misc_h #include "ext.h" #include "ext_obex.h" #include "ext_path.h" typedef struct _mnote { t_uint32 t; t_uint8 note, vel; } t_mnote; typedef struct _mped { t_uint32 t; t_uint8 state; } t_mped; typedef struct _note { t_uint32 t, length; t_uint8 note, vel; } t_note; typedef struct _chordind { int length; int notes[5]; } t_chordind; int isallzeros(int *arr, int l); int containsdup(int *arr1, int *arr2, int l1,int l2); #endif
in main .c file first line #include "misc.h"
. sees structs declared in .h file doesn't see function definition in .c file. when add #include "misc.c"
main file works, why not work .h?
Comments
Post a Comment