반응형


명령 프롬프트는 비주얼 스튜디오의 명령프롬프트(cmd)를 사용한다 

또한 32비트 라이브러리를 뽑을 경우 32bit cmd 를 64라이브러리를 뽑을 경우 64 cmd 를 열어 boost 라이브러리를 생성해야함



b2 -j4 -a --toolset=msvc-11.0 variant=debug,release link=static threading=multi address-model=32 stage runtime-link=static,shared


b2 -j4 -a --toolset=msvc-11.0 variant=debug,release link=static threading=multi address-model=64 stage runtime-link=static,shared






http://imssosso.tistory.com/16





boost 공식 홈페이지 : http://www.boost.org

 

1. boost 홈페이지에서 boost_1_55_0.zip(2013.11.28일 기준 최신 버전)을 다운받는다.

 

2. 다운받은 파일을 원하는 경로에 압축해제를 한다.



3. Command 창을 열고, 압축을 푼 boost 루트 경로로 이동한다. (여기서는 boost_1_55_0으로 압축파일과 동일함.)

    루트 경로에 있는 bootstrap.bat 를 실행하면, boost를 빌드할 수 있는 d2, bjam 실행파일이 생성된 것을 볼 수 있다.

 







< bootstrap 실행 화면 >

 

 


< bootstrap 실행 후 b2,bjam이 생성되어 있다 >   

 

4. b2 를 사용하여, 64bit로 라이브러리를 빌드한다.

- 옵션은 "b2 --help"를  치면, 설명이 쫙~ 나온다.

  => http://www.viper.pe.kr/cgi-bin/moin.cgi/Boost 에가면 boost 설치에 대한 설명이 친절히 나와있다.

      컴파일 옵션에 대한 설명도 한글로 정리되어 있어, 여기를 참고 하여 아래 컴파일 명령을 작성하였다.

 

[ IDE : vs2010 ]

b2 -j4 -a --toolset=msvc-10.0 variant=debug,release link=static threading=multi address-model=64 stage

 

[ IDE : vs2012  ]

위의 --toolset 옵션을 msvc-11.0으로 바꾸면 된다.

 

5. 빌드가 끝나면, boost_1_55_0/state/libs 에는 lib 파일이 생성된 걸 확인할 수 있다. 

< 생성된 lib 파일들 >

 

6. 샘플 소스의 프로젝트를 열고, boost 라이브러리의 경로를 설정한다. (vs2010, vs2013 모두 동일)

  - C/C++ > General > Additional Include Directories 에 "C:\boost_1_55_0" 추가

  - Linker > General > Additional Library Directories 에 "C:\boost_1_55_0\stage\lib" 추가

 

7. vs2010, vs2013 프로젝트 모두 빌드 완료!

 

**  vs2010 에서 빌드를 하니, 아래와 같은 링크 오류가 발생하였다.

     해결방법 => LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt







* Boost  C++ Library  설치방법

- version 1.55.0 기준

http://www.boost.org/

    - 다운로드 : http://sourceforge.net/projects/boost/files/boost/


    - 환경변수 설정 : Boost_root = 압축푼 경로


    - %Boost_root%\bootstrap.bat 실행
        - Bjam.exe, b2.exe 생성됨


    - 라이브러리 빌드(build)(Visual Studio 2010, VC10 기준)
      - b2.exe 옵션 : http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html

b2 toolset=msvc-10.0  link=staic  runtime-link=static,shared 
    - 생성파일 : ex) libboost_atomic-vc100-mt-1_55.lib
        Release [ -mt-s- (static), -mt- (shared)  ], Debug [ -mt-sgd-, -mt-gd- ]

b2 toolset=msvc-10.0  link=shared
    - 생성파일 : ex) boost_atomic-vc100-mt-1_55.lib , 같은 이름 dll
        Release [ -mt- ], Debug [ -mt-gd- ]



    - 프로젝트 설정
        - Include 경로 추가  $(Boost_root)
        - library 경로 추가  $(Boost_root)\stage\lib


    - 환경변수에서 실행경로 추가 : %Boost_root%\stage\lib

        
//===========================
- 샘플 프로젝트 빌드시 에러처리

asio samples : http://sourceforge.net/projects/asio-samples/
    - cannot open file libboost_system-vc100-mt-sgd-1_55.lib
    -> 해결 방법 : lib 빌드시 옵션으로 link=staic  runtime-link=static 설정

- 모든 프로젝트가 static library 와 link되는 문제
    - Multi-threaded Debug DLL (/MDd) 설정을 해도  libboost_XXX.lib 와 연결되는 문제

- DLL 사용하도록 컴파일(Compile) 방법

    -> 해결 방법 :  %Boost_root%\boost/config/user.hpp 수정
        #define BOOST_ALL_DYN_LINK  <-- 주석 해제



//=================================
- Library Naming(라이브러리 파일 이름 명명 규칙)
http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html#library-naming
    - lib로 시작하면 static, DLL파일 없음
    - mt = multi threading

    - s : static , [b2 option 에서 runtime-link=static 으로 설정]
    - d : 디버그 버전

    - g : 디버그 버전 사용함
    - y : Python debug

    - p : STLPort 표준 lib 를 우선적으로 사용함



반응형

+ Recent posts