Linking boost library makefile error

Hi!
I am to use boost library in my project. I have it already installed on Ubuntu, but when running makefile in terminal I encountered such an error:
1
2
3
4
5
6
7
8
9
10
11
12
test.o: In function `init_unit_test()':
test.cpp:(.text+0x4b): undefined reference to `boost::unit_test::framework::maser_test_suite()'
test.o: In function `main':
test.cpp:(.text+0x9e): undefined reference to `boost::unit_test::unit_test_mainbool (*)(), int, char**)'
test.o: In function `boost::unit_test::unit_test_log_t::unit_test_log_t()':
test.cpp:(.text._ZN5boost9unit_test15unit_test_log_tC2Ev[_ZN5boost9unit_test15uit_test_log_tC5Ev]+0x2b): 
undefined reference to `vtable for boost::unit_test::nit_test_log_t'
test.o: In function `boost::unit_test::unit_test_log_t::~unit_test_log_t()':
test.cpp:(.text._ZN5boost9unit_test15unit_test_log_tD2Ev[_ZN5boost9unit_test15uit_test_log_tD5Ev]+0x13): 
undefined reference to `vtable for boost::unit_test::nit_test_log_t'
collect2: error: ld returned 1 exit status
make: *** [proj2] Error 1


Makefile code:
1
2
3
4
5
6
7
8
9
10
11
all: proj2
proj2: Wrapper.o inherit.o test.o
	g++ Wrapper.o inherit.o test.o -o proj2
Wrapper.o: Wrapper.cpp
	g++ -c -Wall Wrapper.cpp
inherit.o: inherit.cpp
	g++ -c -Wall inherit.cpp
test.o: test.cpp
	g++ -c -Wall test.cpp -lboost_unit_test_framework-mt
clean:
	rm rf *o proj2

What is wrong with that?
Last edited on
man wrote:
When you invoke GCC, it normally does preprocessing, compilation,
assembly and linking. The "overall options" allow you to stop
this process at an intermediate stage. For example, the -c option
says not to run the linker. Then the output consists of object
files output by the assembler.
g++ -c -Wall test.cpp -lboost_unit_test_framework-mt 
-lboost_unit_test_framework-mt is ignored

1
2
3
4
all: proj2
proj2: Wrapper.o inherit.o test.o
	#this is the linking stage
	g++ Wrapper.o inherit.o test.o -lboost_unit_test_framework-mt -o proj2
Thank a lot! It helped;)
Topic archived. No new replies allowed.