chbrown / slda

Supervised Latent Dirichlet Allocation for Classification
GNU General Public License v2.0
85 stars 25 forks source link

NULL keyword not declared? #1

Open nesanders opened 10 years ago

nesanders commented 10 years ago

Hello,

When trying to compile this project, I received the following error:

g++ main.cpp corpus.cpp slda.cpp utils.cpp opt.cpp -o slda -lgsl -lm -lgslcblas
In file included from corpus.cpp:22:0:
corpus.h: In constructor ‘document::document()’:
corpus.h:39:17: error: ‘NULL’ was not declared in this scope
         words = NULL;
                 ^
corpus.h: In destructor ‘document::~document()’:
corpus.h:55:22: error: ‘NULL’ was not declared in this scope
         if (words != NULL)

Looking at [http://stackoverflow.com/questions/462165/error-null-was-not-declared-in-this-scope](this thread) suggests that the cstddef library needs to be included in corpus.h.

#include <cstddef>

With this change, I can compile successfully.