
Hi; This is my first attempt at using Boost. Thought I'd start with the unit test lib. I tried to make unit_test_framework1.cpp, which compiled but failed to link, producing several errors like the one below: C:/Boost/lib/libboost_unit_test_framework-mgw-s-1_32.lib(test_tools.obj)(.rdata$_ZTISt9exception+0x0):test_tools.cpp: first defined here /mingw/lib/libstdc++.a(vterminate.o)(.text$_ZTSSt9exception+0x0): multiple definition of `typeinfo name for std::exception' I compiled the Boost library using bjam with following options: bjam "-sMINGW_ROOT_DIRECTORY=C:\Dev-Cpp\bin" "-sTOOLS=mingw" "-sBUILD=release <runtime-link>static <threading>single" install Result: ...failed updating 10 targets... ...skipped 3 targets... ...updated 3164 targets... My cmd. to make unit_test_framework1.cpp is: g++ -I"C:\Boost\include\boost-1_32" -L"C:\Boost\lib" C:\Boost\lib\libboost_unit_test_framework-mgw-s-1_32.lib -o boost_test.exe boost_test.o Thank You for Your patience and help Jacek <http://www.boost.org/libs/test/example/unit_test_example1.cpp>

Hi; I think I figured everything out, thank You to anyone who actually looked at my question. Below are my findings, (for anyone new to boost)
I compiled the Boost library using bjam with following options: bjam "-sMINGW_ROOT_DIRECTORY=C:\Dev-Cpp\bin" "-sTOOLS=mingw" "-sBUILD=release <runtime-link>static <threading>single" install
This is correct, as long as You're creating a release version of Your program and only need static linking with no multithreading.
My cmd. to make unit_test_framework1.cpp is: g++ -I"C:\Boost\include\boost-1_32" -L"C:\Boost\lib" C:\Boost\lib\libboost_unit_test_framework-mgw-s-1_32.lib -o boost_test.exe boost_test.o
This was rather wrong, below is a small make file which works. One thing to note is that the -l switch does not work on windows for specific library files. Instead the entire path to the library must be specified... # Vars CXX = g++.exe CC = gcc.exe EXE = test.exe SRC = test.cpp OBJ = test.o # Base dirs BOOST_BASE_DIR = C:/Boost STD_BASE_DIR = C:/Dev-Cpp # Include files INC = -I$(BOOST_BASE_DIR)/include/boost-1_32 # Lib dir and files LIB = -L$(BOOST_BASE_DIR)/lib -L$(STD_BASE_DIR)/lib LIB_FILES = $(BOOST_BASE_DIR)/lib/libboost_unit_test_framework-mgw-s.lib # Link the exe $(EXE) : $(OBJ) $(CXX) $(OBJ) -o $(EXE) $(LIB) $(LIB_FILES) # Create objects $(OBJ) : $(SRC) $(CXX) -c $(SRC) -o $(OBJ) $(INC) # Cleanup .PHONY: clean clean: rm -f $(OBJ) $(EXE) Once again thank You for Your time Jacek
participants (1)
-
Jacek Pakulski