[mingw version]
[g++ version]
$ g++ --version
g++.exe (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[test.cpp]
#include <stdio.h> #include <boost/thread.hpp> void func() { printf("thread\n"); } int main() { printf("main\n"); boost::thread t(func); t.join(); return 0; }
[makefile]
CC=g++
LIB_DIR=/mingw/lib
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-1_47.a # error
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-1_47.dll # ok
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-1_47.dll.a # ok
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-d-1_47.a # error
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-d-1_47.dll # ok
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-d-1_47.dll.a # ok
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-s-1_47.a # error
#LDLIBS+=$(LIB_DIR)/libboost_thread-mgw45-mt-sd-1_47.a # error
#LDLIBS+=$(LIB_DIR)/libboost_thread-vc80-mt-1_47.lib # error
#LDLIBS+=$(LIB_DIR)/libboost_thread-vc80-mt-gd-1_47.lib # error
#LDLIBS+=-lboost_thread-mgw45-mt-1_47 # ok
#LDLIBS+=-lboost_thread-mgw45-mt-d-1_47 # ok
#LDLIBS+=-lboost_thread-mgw45-mt-s-1_47 # error
#LDLIBS+=-lboost_thread-mgw45-mt-sd-1_47 # error
#LDLIBS+=-lboost_thread-vc80-mt-1_47.lib # can not find
#LDLIBS+=-lboost_thread-vc80-mt-gd-1_47 # can not find
all: test
test: test.o
clean:
rm -rf test
rm -rf *.o
[conclusion]
1. I can not link boost library statically in application(test.exe). Is there anyone who can succeed this?
2. Dll files are required in binary directory(for example, /usr/bin) to execute test.exe.