|
//testa.h
struct ca
{
inline void ca1();
int j;
};
void test_inline2();
//testa.cpp
inline void ca::ca1()
{
int i=10;
printf("inline test\n");
}
// !!!注释下面函数,就会链接失败
void test_inline2()
{
ca a;
a.ca1();
}
// main.cpp
void test_inline()
{
ca a;
a.ca1();
}
int _tmain(int argc, _TCHAR* argv[])
{
test_inline();
return 0;
}
我把inline 函数的实现放在了CPP里,注释掉上面所说的函数会链接失败,不知道为什么, 大家有没办法。 |
|