• bug {was not declared in this scope}


    使用自己定义的结构体作为返回值的时候,出现了

    。。。was not declared in this scope

    检查了各种头文件,把缓存也都删掉了还是不行。

    结果,发现,应该这样用vector<MyClass:: myStruct>

     error: ‘particle’ was not declared in this scope
     vector<particle> Pfloc::pf_init_particles(particle* particles,unsigned x0,unsigned y0)
            ^
    /home/xy/code/pfloc_ubuntu/src/pfloc.cpp:56:16: error: template argument 1 is invalid
     vector<particle> Pfloc::pf_init_particles(particle* particles,unsigned x0,unsigned y0)
                    ^
    /home/xy/code/pfloc_ubuntu/src/pfloc.cpp:56:16: error: template argument 2 is invalid
    /home/xy/code/pfloc_ubuntu/src/pfloc.cpp:56:18: error: prototype forint Pfloc::pf_init_particles(Pfloc::particle*, unsigned int, unsigned int)’ does not match any in class ‘Pfloc’
     vector<particle> Pfloc::pf_init_particles(particle* particles,unsigned x0,unsigned y0)
                      ^
    In file included from /home/xy/code/pfloc_ubuntu/src/pfloc.cpp:1:0:
    /home/xy/code/pfloc_ubuntu/include/pfloc.h:44:19: error: candidate is: std::vector<Pfloc::particle> Pfloc::pf_init_particles(Pfloc::particle*, unsigned int, unsigned int)
      vector<particle> pf_init_particles(particle* p,unsigned x0, unsigned y0);
                       ^
    /home/xy/code/pfloc_ubuntu/include/pfloc.h:32:4: error: ‘typedef struct Pfloc::particle Pfloc::particle’ is private
      } particle;
        ^
    /home/xy/code/pfloc_ubuntu/src/pfloc.cpp:56:43: error: within this context
     vector<particle> Pfloc::pf_init_particles(particle* particles,unsigned x0,unsigned y0)
  • 相关阅读:
    Yahoo! 35条网站性能优化建议
    常见排序
    文件上传于拖拽
    离线web存储
    【前端学习】【jQuery选择器】
    【前端学习】【CSS选择器】
    【疯狂Java讲义学习笔记】【流程控制与数组】
    【疯狂Java讲义学习笔记】【数据类型与运算符】
    【疯狂Java学习笔记】【理解面向对象】
    【疯狂Java学习笔记】【第一章:Java语言概述】
  • 原文地址:https://www.cnblogs.com/xy123001/p/6639608.html
Copyright © 2020-2023  润新知