title: Adding Public or Private members to class gives various Run-time errors
body: <p>So for some reason, when trying to add a 'stack' variable to a class (public or private) in this multi-class project, it will give a run-time error: </p>
  
  <pre><code>terminate called after throwing an instance of 'std::bad_alloc'
    what():  std::bad_alloc
  </code></pre>
  
  <p>or</p>
  
  <pre><code>terminate called after throwing an instance of 'std::length_error'
    what():  deque::_M_new_elements_at_front
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Segmentation fault (Core Dumped)
  </code></pre>
  
  <p>This depends on the type of stack I try to add, it seems.</p>
  
  <p>I commented out all of the methods (in the .cpp and the .h) except for the constructor, and the things I'm trying to add aren't referenced anywhere, but it always gives an error. The odd thing is, I already have a stack that works fine, stored as public, I simply can't add any more.</p>
  
  <p>From Main.cpp:</p>
  
  <pre><code>int main(int, char* argv[])
  {
      Scanner funScanner = Scanner(argv[1]);
      DatalogProgram funProgram = DatalogProgram(funScanner.tokenize());
  
  }
  </code></pre>
  
  <p>From my DatalogProgram.h file:</p>
  
  <pre><code>class DatalogProgram
  {
      public:
          DatalogProgram(stack &lt;Token&gt; tokensFromScanner);
          stack &lt;Token&gt; tokenStack; //&lt;-- this one seems to work fine
  
  
  
      private:
          stack &lt;Predicate&gt; schemes;
          stack &lt;Predicate&gt; facts;
          stack &lt;Rule&gt; rules;        //These 4 stacks are based on other classes, but even the int stack gives a similar error
          stack &lt;Predicate&gt; queries;
          stack &lt;int&gt; testStack; //&lt;-- this stack also gives a run-time error
  };
  </code></pre>
  
  <p>Any ideas why it might be doing this?</p>
  
  <p>UPDATE: I've been running my project file through a makefile, so I tried running it without it, and I got another error, </p>
  
  <pre><code>terminate called after throwing an instance of 'std::logic_error'
    what():  basic_string::_M_construct NULL not valid
  </code></pre>
  
  <p>Upon searching that error, it looks like there must be a string set to a null pointer, so I'm currently looking for that.</p>