Undefined reference to private variable

This is probably a very dumb error, but I can't figure out what's wrong with this code. Looked all over the internet and couldn't find a solution.

shell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
class Recognizer {
    public:
        Recognizer(int argc, char* argv[]);
    private: 
        //General sphinx stuff
        cmd_ln_t *config;
        ps_decoder_t* ps;
        FILE* rawfd; 

        //for microphone
        ad_rec_t *ad;
        int16 adbuf[2048];
        uint8 utt_started, in_speech;
        int32 k;
        char const *hyp;
};
...


shell.cpp
1
2
3
4
5
6
...
Recognizer::Recognizer(int argc, char* argv[]) {
    config = cmd_ln_parse_r(NULL, cont_args_def, argc, argv, TRUE);
    ps = ps_init(config);

}


Makefile
1
2
3
4
5
6
7
8
9
10
11
12
CC=g++
CFLAGS=-I. -g -I/usr/local/include/sphinxbase
DEPS = shell.h
OBJECT_FILES=main.o shell.o 
LIB_PATH=-lFestival -lestools -lestbase -leststring -lreadline -lpocketsphinx -lsphinxad -lsphinxbase
TARGET=shell
...
%.o: %.c $(DEPS)
	$(CC) -o $@ $< $(LIB_PATH) $(CFLAGS)

main: $(OBJECT_FILES)
	$(CC) -o $@ $^ $(LIB_PATH) $(CFLAGS)


Compilation output
1
2
3
4
...
shell.cpp:(.text+0xe9): undefined reference to `Recognizer::config'
shell.cpp:(.text+0xf0): undefined reference to `Recognizer::config'
collect2: error: ld returned 1 exit status


Basically, there is an undefined reference to the private member variable config in class Recognizer.
It looks like the list of *.cpp is missing.
Edited my makefile, thanks
Topic archived. No new replies allowed.