undefined reference to `boost::program_options
Jan 5, 2012 at 11:43pm UTC
Hi Using boost for the first time, installed it from source and using a makefile to link.
I believe the undefined reference to boost::program_options is a linking error and the include file seems to recognized in eclipse
1 2 3 4 5 6 7 8 9 10 11 12 13 14
CC=g++
CFLAGS=-c -Wall
LDFLAGS= -L/usr/local/lib/ -lboost_filesystem -lboost_system -lboost_program_options
SOURCES= crypto/ciphertext.cpp crypto/digest32.cpp crypto/elgamal.cpp crypto/equalitydisclog_zpschnorr.cpp crypto/group.cpp crypto/keygenerator.cpp crypto/keypair.cpp crypto/knowdisclog_zpschnorr.cpp crypto/sha.cpp math/gmp_bigint.cpp crypto/config.cpp testcipher.cpp timer.cpp crypto/vector.cpp testcipher.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=app
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
Jan 5, 2012 at 11:47pm UTC
That particular boost library requires that the library be built first (most of boost is headers only). Are the lib files definitely present in /usr/local/lib/ ?
Jan 5, 2012 at 11:56pm UTC
yes they have .a and .o extensions e.g libboost_program_options.a
Jan 6, 2012 at 11:09am UTC
Uninstalled the entire boost library, and the compile source. I have reinstalled solely program_options using
sudo apt-get install libboost-program-options-dev
I have updated the makefile to
1 2 3 4 5 6 7 8 9 10 11 12 13 14
CC=g++
CFLAGS=-c -Wall
LDFLAGS= -L/usr/lib/ -lboost_program_options
SOURCES= crypto/ciphertext.cpp crypto/digest32.cpp crypto/elgamal.cpp crypto/equalitydisclog_zpschnorr.cpp crypto/group.cpp crypto/keygenerator.cpp crypto/keypair.cpp crypto/knowdisclog_zpschnorr.cpp crypto/sha.cpp math/gmp_bigint.cpp crypto/config.cpp testcipher.cpp timer.cpp crypto/vector.cpp testcipher.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=app
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
Redolved by changing the profect to a makefile project and automatically generating the makefile rather than using my own
Last edited on Jan 6, 2012 at 2:15pm UTC
Topic archived. No new replies allowed.