错误:'struct'中未初始化的引用成员

时间:2016-01-28 15:25:42

标签: c++ class gcc reference initialization

我正在尝试编译http://www.cis.upenn.edu/~bjbrown/tps_alignment/tps_alignment_20110502.tar.gz处提供的 C ++代码

特定文件 include / global_reg.h 有一个名为class的{​​{1}},其中定义了私有成员变量 threaded_alignment

data

构造函数定义为

  // This stuff really doesn't need to be in a struct, it
  // could just be member data.  But this leads to a marginally
  // less verbose initialization using memcpy.
  struct align_scan_struct {
    const opts_t &opts;
    const vector<char *> &mesh_names;
    const vector<corr_vector> &corrs;
    const vector<point> &targets;
    const vector<bool> &use_points;
    const vector<float> &confidence;
    TriMesh *points_mesh;
    const vector<TriMesh::Face> &all_faces;
    threaded_alignment *ta;
  } data;

但是,在 mingw32 gcc 上编译 GCC 5.1.0 时,我在此 threaded_alignment(const opts_t &opts, const vector<char *> &mesh_names, const vector<corr_vector> &corrs, const vector<point> &targets, const vector<bool> &use_points, const vector<float> &confidence, TriMesh *points_mesh, const vector<TriMesh::Face> &all_faces) : counter(0) { pthread_mutex_init(&counter_mutex, NULL); pthread_mutex_init(&mesh_mutex, NULL); align_scan_struct d = { opts, mesh_names, corrs, targets, use_points, confidence, points_mesh, all_faces, this }; memcpy(&data, &d, sizeof(align_scan_struct)); threads.resize(opts.nthreads); for (int i = 0; i < opts.nthreads; i++) { pthread_create(&threads[i], NULL, alignment_thread, (void *) &data); } } 中收到以下错误:

constructor

对错误的任何帮助或提示都将受到高度赞赏。

0 个答案:

没有答案