草庐IT

c++ - 字段类型不完整

coder 2024-02-12 原文

我得到错误的“字段有不完整的类型”,但也不知道为什么。有人能帮忙吗?谢谢!

g++ -pipe -W -Wall -fopenmp -ggdb3 -DDEBUG -fno-omit-frame-pointer  -c -o test.o ../../src/test.cc  
In file included from ../../src/test.cc:50:  
../../src/feature_haar.h:14: error: field ‘_count’ has incomplete type  

抄袭
#include "feature_count.h"  
#include "feature_random_counts.h"  
#include "feature_corner.h"  
#include "feature_haar.h" // line 50  

特征_haar.h
#ifndef FEATURE_HAAR_H  
#define FEATURE_HAAR_H  

#include "misc.h"  
#include "feature.h"  
#include "vignette.h"  
#include "feature_count.h"  
#include <cassert>  

class FeatureHaar: public Feature    
{  
 public:  

  FeatureCount _count;// line 14  
...  
}  
#endif  

特征计数.h
#ifndef FEATURE_COUNT_H  
#define FEATURE_COUNT_H  

#include "misc.h"  
#include "feature.h"  
#include "random_rect.h"  
//#include "feature_integral_img.h"  


class FeatureCount: public Feature {  

  public:  

   RandomRect _rect;  


   char _type[buffer_size];  


   // This method returns an upper-caps string to identify the feature  
   const char *name() ;  

   FeatureCount();  


   FeatureCount( int width, int height, const char *type = "black-count", float WHRatio=-1, int roi_x=0, int roi_y=0, int roi_w=0, int roi_h=0 );  


   ~FeatureCount();  




   // compute features from original data i.e. image  
   void compute(double *integral_image, double *feature);  


   // IO  
   void write_humanreadable(ostream *out);  
   void write(ostream *out);  
   void read(istream *in):  
 };  


#endif  

特征H
 #ifndef FEATURE_H  
 #define FEATURE_H  

 #include "misc.h"  
 #include "vignette.h"  


 class Feature {// generate the feature from the original data of an example, not responsible for holding the feature.  
 public:  
   int _dim;  


   // We need a virtual destructor since there are virtual methods  
   virtual ~Feature();  

   // This method returns an upper-caps string to identify the feature  
   virtual const char *name() = 0;  


   // write the data into files  
  static void write_matrix_data(double ** features, int *labels, int nb_examples, int dim, const char * filename);  
  static void write_index_data(double ** features,int *labels, int nb_examples, int dim, const char * filename);  
  static void write_compact_data(double ** features, int *labels, int nb_examples, int dim, const char * filename);  



   // compute features from original data i.e. image  
   virtual void compute(Vignette *vignette, double * feature); // this function/class not responsible for allocating/deallocation memory for array feature  
   virtual void compute(double *integral_image, double *feature);  



 // feature preprocessing  

   // scaling each feature s.t. its sample max = 1 and min = 0   
   static void scale_features(double *Data, int dim, double *scales_min, double *scales_max);  
   static void compute_linear_scale(double **Data, int size, int dim, double *scales_min, double *scales_max);  

   // standardize each feature s.t. its sample mean = 0 and sample standard deviation = 1  
   static void standardize_features(double *Data, int dim, double *mean, double *std);  
   static void compute_standardization(double **Data, int size, int dim, double *mean, double *std);  


 };  

 #endif  

最佳答案

谢谢所有帮助我的人。这是我的错。FeatureCount的定义不正确。其成员

void read(istream *in): 

应以“;“not”结尾。
这么小的排版怎么这么难找到?

关于c++ - 字段类型不完整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2024658/

有关c++ - 字段类型不完整的更多相关文章

  1. ruby-on-rails - 如何优雅地重启 thin + nginx? - 2

    我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server

  2. ruby-on-rails - 如何验证非模型(甚至非对象)字段 - 2

    我有一个表单,其中有很多字段取自数组(而不是模型或对象)。我如何验证这些字段的存在?solve_problem_pathdo|f|%>... 最佳答案 创建一个简单的类来包装请求参数并使用ActiveModel::Validations。#definedsomewhere,atthesimplest:require'ostruct'classSolvetrue#youcouldevencheckthesolutionwithavalidatorvalidatedoerrors.add(:base,"WRONG!!!")unlesss

  3. ruby-on-rails - form_for 中不在模型中的自定义字段 - 2

    我想向我的Controller传递一个参数,它是一个简单的复选框,但我不知道如何在模型的form_for中引入它,这是我的观点:{:id=>'go_finance'}do|f|%>Transferirde:para:Entrada:"input",:placeholder=>"Quantofoiganho?"%>Saída:"output",:placeholder=>"Quantofoigasto?"%>Nota:我想做一个额外的复选框,但我该怎么做,模型中没有一个对象,而是一个要检查的对象,以便在Controller中创建一个ifelse,如果没有检查,请帮助我,非常感谢,谢谢

  4. ruby - Infinity 和 NaN 的类型是什么? - 2

    我可以得到Infinity和NaNn=9.0/0#=>Infinityn.class#=>Floatm=0/0.0#=>NaNm.class#=>Float但是当我想直接访问Infinity或NaN时:Infinity#=>uninitializedconstantInfinity(NameError)NaN#=>uninitializedconstantNaN(NameError)什么是Infinity和NaN?它们是对象、关键字还是其他东西? 最佳答案 您看到打印为Infinity和NaN的只是Float类的两个特殊实例的字符串

  5. ruby - 检查方法参数的类型 - 2

    我不确定传递给方法的对象的类型是否正确。我可能会将一个字符串传递给一个只能处理整数的函数。某种运行时保证怎么样?我看不到比以下更好的选择:defsomeFixNumMangler(input)raise"wrongtype:integerrequired"unlessinput.class==FixNumother_stuffend有更好的选择吗? 最佳答案 使用Kernel#Integer在使用之前转换输入的方法。当无法以任何合理的方式将输入转换为整数时,它将引发ArgumentError。defmy_method(number)

  6. ruby-on-rails - 在 Rails 和 ActiveRecord 中查询时忽略某些字段 - 2

    我知道我可以指定某些字段来使用pluck查询数据库。ids=Item.where('due_at但是我想知道,是否有一种方法可以指定我想避免从数据库查询的某些字段。某种反拔?posts=Post.where(published:true).do_not_lookup(:enormous_field) 最佳答案 Model#attribute_names应该返回列/属性数组。您可以排除其中一些并传递给pluck或select方法。像这样:posts=Post.where(published:true).select(Post.attr

  7. ruby - Ruby 有 `Pair` 数据类型吗? - 2

    有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳

  8. ruby - 查找字符串中的内容类型(数字、日期、时间、字符串等) - 2

    我正在尝试解析一个CSV文件并使用SQL命令自动为其创建一个表。CSV中的第一行给出了列标题。但我需要推断每个列的类型。Ruby中是否有任何函数可以找到每个字段中内容的类型。例如,CSV行:"12012","Test","1233.22","12:21:22","10/10/2009"应该产生像这样的类型['integer','string','float','time','date']谢谢! 最佳答案 require'time'defto_something(str)if(num=Integer(str)rescueFloat(s

  9. ruby-on-rails - 在 Rails 开发环境中为 .ogv 文件设置 Mime 类型 - 2

    我正在玩HTML5视频并且在ERB中有以下片段:mp4视频从在我的开发环境中运行的服务器很好地流式传输到chrome。然而firefox显示带有海报图像的视频播放器,但带有一个大X。问题似乎是mongrel不确定ogv扩展的mime类型,并且只返回text/plain,如curl所示:$curl-Ihttp://0.0.0.0:3000/pr6.ogvHTTP/1.1200OKConnection:closeDate:Mon,19Apr201012:33:50GMTLast-Modified:Sun,18Apr201012:46:07GMTContent-Type:text/plain

  10. ruby - 使用 `+=` 和 `send` 方法 - 2

    如何将send与+=一起使用?a=20;a.send"+=",10undefinedmethod`+='for20:Fixnuma=20;a+=10=>30 最佳答案 恐怕你不能。+=不是方法,而是语法糖。参见http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html它说Incommonwithmanyotherlanguages,Rubyhasasyntacticshortcut:a=a+2maybewrittenasa+=2.你能做的最好的事情是:

随机推荐