c·c++

boost compile

toyship 2013. 7. 31. 18:42
반응형


boost는 소스를 다운 받아서, 컴파일 해서 필요한 라이브러리를 사용해야 한다.

boost는 bjam이라는 놈으로 컴파일을 한다.


http://www.boost.org/users/download/

에서 다운을 받는다.

나는 그냥 svn 연결해서 받았다. ( 한참 받는다..   )


다운받은 폴더에 보면

"bootstrap.bat"   이놈을 실행시킨다.

그러면, 컴파일에 필요한 놈들이 생겨난다.


visual studio 명령프롬프트를 실행해서 다운받은 root로 이동한다.

( x86,  x64 구분해서 명령프롬프트를 실행해야 한다 )

그다음 bjam으로 컴파일 하면 된다.

( 컴파일도 한참 걸린다 )


예 )  아래내용은 이카르트의 이야기 에서 발췌한 내용을 가져온것 입니다.

32비트용
bjam --toolset=msvc-10.0 link=static runtime-link=static,shared variant=release,debug threading=multi --libdir=e:\boost\lib\ install -j4


64비트용
bjam --toolset=msvc-10.0 link=static runtime-link=static,shared variant=release,debug --architecture=x86 address-model=64 threading=multi --libdir=e:\boost\lib\x64\ install -j4


위는 static library 컴파일 이고, dll을 만들기 원하면 아래처럼, static 이라고 되어 있는 단어를 shared 로 변경해야 한다.

bjam.exe threading=multi link=shared runtime-link=shared

 

그리고, 사용하는 프로그램에서 컴파일 옵션이나 소스에 

#define BOOST_ALL_DYN_LINK

을 해주어서 dll을 사용할수 있도록 해야 한다.


별도의 output directory를 지정하지 않으면

boost\stage  에 생성된다.

반응형

'c·c++' 카테고리의 다른 글

shared_ptr and weak_ptr  (0) 2014.01.20
CGAL compile  (0) 2013.08.01
stdint.h and inttypes.h 파일을 찾을 수 없을때  (0) 2012.10.25
Visual Studio 2008 에서 컴파일시 파일 복사하기.  (0) 2012.10.24
gdal에서 링크에러  (0) 2012.06.30