My project has the following 4 files: main.c
, rcm.h
, rcm.c
and queue.c
.
In rcm.h
I'm declaring all functions implemented in rcm.c
and queue.c
.
rcm.c
looks like:
#include "rcm.h"
void rcm (void) {
Queue *Q = init(10);
/* Some other stuff */
}
queue.c` looks like:
#include "rcm.h"
extern inline Queue* init(int n) {
return malloc(sizeof(Queue*);
}
and rcm.h
:
#ifndef __RCM__
#define __RCM__
typedef struct queue { /*...*/ } Queue;
void rcm( void );
inline Queue* init( int n );
#endif
When compiling I get the the warnings
gcc-7 -O0 -c rcm.c -o rcm.o
In file included from rcm.c:15:0:
rcm.h:58:15: warning: inline function 'init' declared but never defined
inline Queue* init(int size);
^~~~
gcc-7 -c queue.c -o queue.o
gcc-7 main.c lib/rcm.o queue.o -o main
In file included from main.c:4:0:
inc/rcm.h:58:15: warning: inline function 'init' declared but never defined
inline Queue* init(int size);
^~~~
But, when I am not declaring init()
as inline
compiles normally.