error: 'class Crc' has no member named 'table_idx_width'

This is my very first question here so I apologize if I don't get all the fancy formatting correct. The "Preview" button doesn't actually seem to work either so I'm double sorry. D:
EDIT: Got the preview and formatting to work :)

I'm using WinGW to compile a C++ program. I'm not going to include the entire .cpp file because it's pretty long, but here's the piece of my C++ File that's giving me the error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  #include "crc_algorithms.h"
  #include <stdio.h>
  #include <string.h>
  #include <iostream>
  using namespace std;

  Crc::Crc(int width, int poly, bool reflect_in, int xor_in, bool reflect_out, int xor_out,
           bool direct, int table_idx_width) {
      this->width           = width;
      this->poly            = poly;
      this->reflect_in      = reflect_in;
      this->xor_in          = xor_in;
      this->reflect_out     = reflect_out;
      this->xor_out         = xor_out;
      this->direct          = direct;
      this->table_idx_width = table_idx_width; // <-- This is Line 82
  }


And here's the header file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  class Crc {
      public:
          Crc (int width, int poly, bool reflect_in, int xor_in, bool reflect_out, int xor_out,
               bool direct=true, int table_idx_width = 0);
          int getDirectInit(int init);
          int getNondirectInit(int init);
          int reflect(int data, int width);
          int bitByBit(char str[]);
          int bitByBitFast(char str[]);
          char genTable();
          int tableDriven(char str[]);

      private:
          int width;
          int poly;
          int reflect_in;
          int xor_in;
          int reflect_out;
          int xor_out;
          bool direct;
          int MSB_Mask, Mask;
          int DirectInit, NonDirectInit;
          int TableWidth;
  };


This is the error message that WinGW spits out:

1
2
  crc_algorithms.cpp: In constructor `Crc::Crc(int, int, bool, int, bool, int, bool, int)':
  crc_algorithms.cpp:82: error: 'class Crc' has no member named 'table_idx_width' 


At first I thought it was a problem with setting table_idx_width to 0 in the header, but removing that gave the same error.

So, why does it say table_idx_width is missing? I've been staring at it all day and I cannot figure it out.
Last edited on
because there is no member of Crc named table_idx_width.
In header members are declared on lines 13 through 22, and there is no table_idx_width at all.
Hurr durr, putting it all in one place without all the extra garbage has me seeing the error now. I don't declare table_idx_width in my header file under private.

May the derp be with you.
Dang I hate refreshing the page each time. Thanks MiiNiPaa. :)
Topic archived. No new replies allowed.