关于内联函数的定义有关问题

关于内联函数的定义问题
网上说最好在头文件中定义内联函数,这样每个编译单元在需要在调用处展开内联函数的时候才能找到内联函数的定义。

于是我在在一个头文件mysocket.h中定义了一个内联函数。

//mysocket.h
#ifndef _MYSOCKET_H_
#define _MYSOCKET_H_
//一堆标准头文件,忽略。。。
int listen_socket(in_addr_t ip,int backlog);
inline void print_error_location(void)
{
fprintf(stderr,"-->%s,%s,%d,",__FILE__,__FUNCTION__,__LINE__);
}
#endif

然后在ftpserver.c和mysocket.c中都#include <mysocket.h>。因为在这两个.c文件中都要用这内联函数。ftpserver.c文件中有main函数。

然后:
gcc -std=gnu99 -Wall -c mysocket.c    #没问题。
gcc -std=gnu99 -Wall -c ftpserver.c   #没问题
gcc -std=gnu99 -Wall -o server mysocket.o ftpserver.o  #问题出现了。
报错如下:
mysocket.c:(.text+0x37): undefined reference to `print_error_location'
mysocket.c:(.text+0xaf): undefined reference to `print_error_location'
ftpserver.o: In function `main':
ftpserver.c:(.text+0x2f): undefined reference to `print_error_location'
ftpserver.c:(.text+0x69): undefined reference to `print_error_location'
ftpserver.c:(.text+0xbf): undefined reference to `print_error_location'
collect2: ld returned 1 exit status
怎么说我没定义呢?然后,我不这么分开编译了。直接gcc -std=gnu99 -Wall -o server mysocket.c ftpserver.c
还是同样的问题啊。

我在不加-std=gnu99了
gcc  -Wall -o server mysocket.c ftpserver.c
/tmp/ccKxv8xf.o: In function `print_error_location':
ftpserver.c:(.text+0x0): multiple definition of `print_error_location'
/tmp/ccoJSGDi.o:mysocket.c:(.text+0x0): first defined here
collect2: ld returned 1 exit status
这次是说我重复定义了。

好吧。我在换成c99
gcc -std=c99 -Wall -o server mysocket.c ftpserver.c
ftpserver.c: In function ‘main’:
ftpserver.c:7:2: warning: implicit declaration of function ‘inet_aton’ [-Wimplicit-function-declaration]
/tmp/cc7ZG9r2.o: In function `listen_socket':
mysocket.c:(.text+0x37): undefined reference to `print_error_location'
mysocket.c:(.text+0xa4): undefined reference to `print_error_location'
/tmp/ccjQRw2R.o: In function `main':
ftpserver.c:(.text+0x2f): undefined reference to `print_error_location'
ftpserver.c:(.text+0x69): undefined reference to `print_error_location'
ftpserver.c:(.text+0xb5): undefined reference to `print_error_location'
collect2: ld returned 1 exit status
还是说我没定义。

看来c99和gnu99编译结果一样,都是说我没定义。c89说我重复定义了。

原因是什么呢?
难道是C99展开了这个内联而C89没展开这个内联?
内不内联是不是在编译生成中间文件.o文件中时决定的吧?

先听大家解释。我再说我的猜测(猜测无法验证啊)



C 内联函数 GCC

------解决方案--------------------
好像记得 c89 不支持 inline, c99 才引入的
------解决方案--------------------
把内联函数换成宏吧, 

或许是里面 __FILE__,__FUNCTION__,__LINE__ 的这些宏阻止编译器内联了.
------解决方案--------------------
参考http://www.cnblogs.com/cnmaizi/archive/2011/01/19/1939686.html。
------解决方案--------------------
头文件里定义的函数,要加上static啊