ubuntu下,gcc编译tinybind错误

在Ubuntu中使用gcc编译tinybind时遇到了两个主要问题:1) tinybind.h中关于`params'模板参数的声明问题,需要确保非模板参数的名称在解析时已定义;2) tinybind.cpp中ConvertFromString模板特化的声明错误,修正为对const char*的特化。此外,还提到了'ConvertToString'未声明的问题,解决方案是提前声明相关模板函数。
摘要由CSDN通过智能技术生成

1、tinybind.h there are no arguments to `params' that depend on a template parameter, so a declaration of `params' must be available。。。


solution:参考一下文档

11.9.2. Name lookup, templates, and accessing members of base classes

The C++ standard prescribes that all names that are not dependent ontemplate parameters are bound to their present definitions when parsinga template function or class.[1] Only names that are dependent are looked up at the pointof instantiation. For example, consider

  void foo(double);

  struct A {
    template <typename T>
    void f () {
      foo (1);        // 1
      int i = N;      // 2
      T t;
      t.bar();        // 3
      foo (t);        // 4
    }

    static const int N;
  };

Here, the names foo and N appear in a context that doesnot depend on the type ofT. The compiler will thus require thatthey are defined in the context of use in the template, not only beforethe

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值