C++中inline函数 多重定义 不出错?该怎么解决

C++中inline函数 多重定义 不出错?
在看《C++ Primer中文版》第四版 inline函数时,本人在VS2010,32位版本下写了如下代码,发现一个很困惑的现象:
(1)abc.cpp:
#include <iostream>
using namespace std;
extern int minus(int a,int b);
inline int add(int a,int b) { return a+b;}
int main()
{
int s,t,v,w;
cin>>s;
cin>>t;
v=add(s,t);
w=minus(s,t);
cout<<v<<endl;
cout<<w<<endl;
return 0;
}
add.cpp:
inline int add(int a,int b) { return a-b;}
int minus(int a,int b) {return add(a,b);}

经过Ctrl+F5执行,输入“3 4”,得到
7
7
此程序我刻意把两个cpp文件中add函数一个做加法一个做减法以示区别,但为什么编译inline函数连多重定义的错误都没有,这是为什么?为什么在调用mirus函数时不执行add.cpp中的那个add函数(做减法)呢?
(2)保持add.cpp不变,abc.cpp改为:
#include <iostream>
using namespace std;
extern int minus(int a,int b);
inline int add(int a,int b) { return a+b;}
int main()
{
int s,t,v,w;
cin>>s;
cin>>t;
// v=add(s,t);
w=minus(s,t);
// cout<<v<<endl;
cout<<w<<endl;
return 0;
}
此时Ctrl+F5再输入“3 4”,得到结果
-1
(3)将abc.cpp恢复为(1)中的情况,
此时Ctrl+F5再输入“3 4”,却得到结果
-1
-1
PS:有时候仍然会得到
7
7
也就是说同样的代码同样的输入,结果却不同这是为什么?

结合(1),(2),(3),问题:1)C++中inline函数可以多重定义?2)为什么会出现结果不同(7 7/-1 -1)这个情况?
本人初学C++,对编译问题理解的不深刻,希望高手解答,感激不尽!

------解决方案--------------------
inline默认是static的。static的函数仅在本文件内可见。
------解决方案--------------------
其实好久不用C++了,有些概念也记不太清了,我印象里和1楼是一样的。但这个解释虽然能解释出4楼的问题1,但解释不了问题2和3,所以我对1楼表示怀疑。

我在想,不知道是不是楼主用了debug模式编译的,所以inline虽然可以重复定义,但实际上还是生成了链接符号,导致链接到错误的函数上造成的?如果是这样,大概算是VC的BUG了吧。还是等楼下的高人回答吧,我就不胡说八道了。
------解决方案--------------------
哇 你起码先换release试试嘛 inline在debug下肯定是没效果的嘛
------解决方案--------------------
inline函数,本来就是局部的。语义上是就地展开(跟编译器是不是真的做了内联没关系)。只要你保证在同一个include引用路径上不出现两个名称和参数表都一样的内联函数实现,都是完全合法的。(比如你的两个cpp,相当于两个include引用路径)
------解决方案--------------------
探讨

Note: It's imperative that the function's definition (the part between the {...}) be placed in a header file, unless the function is used only in a single .cpp file. In particular, if you put the inl……

------解决方案--------------------
http://blog.bitfoc.us/?p=379
------解决方案--------------------
打开/Wall选项,注释掉v相关代码,有警告:
1>abc.cpp(4): warning C4514: “add”: 未引用的内联函数已移除

打开v相关代码,有警告:
1>e:\temp\testinline\testinline\abc.cpp(11): warning C4711: 为自动内联扩展选定了函数“int __cdecl minus(int,int)”
------解决方案--------------------
还是消除歧义吧。非法的定义,就算编译通过了,结果也没有定义。
声明就是为了做类型检查,混乱的声明只能给编译器和你自己造麻烦。
------解决方案--------------------
算了...你先看这里:
http://en.wikipedia.org/wiki/Inline_function

注意这一段:
“The specification of inline in C99 requires exactly one additional external definition of a function in another compilation unit, when the corresponding inline definition, that can occur multiple times in different compilation units, if that function is used somewhere. That can easily lead to linker errors because such a definition wasn't provided by the programmer. For this reason, inline in C99 often is used together with static, which gives the function internal linkage. 
In C++, it is necessary to define an inline function in every module (compilation unit) that uses it, whereas an ordinary function must be defined in only a single module. Otherwise it would not be possible to compile a single module independently of all other modules. ”