duplicate symbol error in C -


i have following code layout

header.h

#ifndef _header_h #define _header_h void empty(float *array, int l) {     int i;     (i=1 ; i<=l ; i++)     {         array[i]=0;     }  }  #endif 

and 2 files (lets call them file1.c , file2.c)

#include "header.h"  void function/*1 or 2*/(){       ....      empty(a,b);      .... } 

so compiling works fine linker command fails compiler says there duplicate function definition. how can avoid still using header file? working fine when define function in header , create .c file containing full function. thought declaring in header way go.

i thought declaring in header way go.

yes, is. declaring in header fine. not define in header, though. (unless it's static inline, don't want these days.)


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -