
Untitled
By: a guest on
May 21st, 2012 | syntax:
None | size: 0.90 KB | hits: 14 | expires: Never
Multiple definition and header-only librairies
main.c includes utils.h
vector.c includes utils.h
#ifndef UTILS_H_
#define UTILS_H_
// and end with:
#endif
/tmp/ccOE6i1l.o: In function `compare_int':
ivector.c:(.text+0x0): multiple definition of `compare_int'
/tmp/ccwjCVGi.o:main.c:(.text+0x660): first defined here
/tmp/ccOE6i1l.o: In function `compare_int2':
ivector.c:(.text+0x20): multiple definition of `compare_int2'
/tmp/ccwjCVGi.o:main.c:(.text+0x6e0): first defined here
/tmp/ccOE6i1l.o: In function `matrix_alloc':
ivector.c:(.text+0x40): multiple definition of `matrix_alloc'
/tmp/ccwjCVGi.o:main.c:(.text+0x0): first defined here
...
// header.h
void foo() { }
// file1.c
#include "header.h"
// file2.c
#include "header.h"
#ifndef _FOO_H
#define _FOO_H
/* some C stuff here */
#endif /* _FOO_H */
#include <foo.h>
#include <bar.h>
...
#include <foo.h>
...