相关疑难解决方法(0)

Linux上的C++动态共享库

这是使用g ++进行动态共享库编译的后续内容.

我正在尝试在Linux上用C++创建一个共享类库.我能够编译库,我可以使用我在这里这里找到的教程调用一些(非类)函数.当我尝试使用库中定义的类时,我的问题开始了.我链接的第二个教程展示了如何加载符号来创建库中定义的类的对象,但是没有使用这些对象来完成任何工作.

Does anyone know of a more complete tutorial for creating shared C++ class libraries that also shows how to use those classes in a separate executable? A very simple tutorial that shows object creation, use (simple getters and setters would be fine), and deletion would be fantastic. A link or a reference to some open source code that illustrates the use of a shared class library would …

c++ linux shared-libraries

163
推荐指数
4
解决办法
21万
查看次数

C++:在派生类中初始化具有不同值的基类常量静态变量?

我有一个带有常量静态变量a的基类A. 我需要B类的实例对静态变量a有不同的值.如何实现这一点,最好是使用静态初始化?

class A {
public:
    static const int a;
};
const int A::a = 1;

class B : public A {
    // ???
    // How to set *a* to a value specific to instances of class B ?
};
Run Code Online (Sandbox Code Playgroud)

c++ static class-variables

5
推荐指数
1
解决办法
3930
查看次数

标签 统计

c++ ×2

class-variables ×1

linux ×1

shared-libraries ×1

static ×1