+ -
当前位置:首页 → 问答吧 → linux使用自己编译动态库依赖头文件过多的问题

linux使用自己编译动态库依赖头文件过多的问题

时间:2011-12-01

来源:互联网

我现在在将一个类编译成动态库代码结构像下面这样
类A.h
C/C++ code

#include <B.h>
#include <C.h>
class A:public B
{
    C c;
}


将其编译成so之后我在main函数中用类A,
C/C++ code

#include <A.h>
int main()
{
    A a;
}


但是在编译的时候还要#include <B.h> #include <C.h>才能编译,怎样能使我编译好的A.so在使用的时候只#include <A.h>就可以,而不再需要<B.h> <C.h>。

作者: tan_tan_1   发布时间: 2011-12-01

你用了BC,你不include BC 是不行的

作者: icechenbing   发布时间: 2011-12-01

不需要include啊.

作者: qq120848369   发布时间: 2011-12-01