2

I built boost 1.54.0 with Visual Studio 2012 x64.

I tried to build a small demo that is using boost filesystem:

#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;

int main(int argc, char* argv[])
{
  if (argc < 2)
  {
    std::cout << "Usage: tut1 path\n";
    return 1;
  }
  std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
  return 0;
}

CMake is used to setup the corresponding project for VS2012 x64:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
PROJECT(FilesystemTest)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/build/)
# Visual Studio 2010 Pro Standard: /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR
SET(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W4 /Zi /EHsc /GR- /MP /openmp") 

SET(CMAKE_DEBUG_POSTFIX  "d")

FIND_PACKAGE(Boost COMPONENTS filesystem system REQUIRED)

# Unicode rules!
ADD_DEFINITIONS(-D_UNICODE)

include_directories(${Boost_INCLUDE_DIR})

LINK_DIRECTORIES(   ${Boost_LIBRARY_DIRS} )

file(GLOB FilesystemTest_SOURCES src/*.*)

# Create a target for the library
ADD_EXECUTABLE(FilesystemTest
    ${FilesystemTest_SOURCES})

But when compiling I get 'libboost_filesystem-vc110-mt-gd-1_54.lib' is missing.

Perviously I used boost 1.53.0 - everything was working perfect when using boost 1.53.0.

When looking into the boost 1.54 lib folder there is only a 'boost_filesystem-vc110-mt-gd-1_54.lib' and a 'libboost_filesystem-vc110-mt-sgd-1_54.lib'

I compiled boost using this instructions:

  1. Download boost 1.54.0 from http://www.boost.org/
  2. Extract files (e.g. “C:\thirdparty\vs2013\x64\boost_1_54_0”)
  3. Start Visual Studio 2012 x64 command prompt
  4. Change to boost directory (e.g. “cd C:\thirdparty\vs2010\x64\boost_1_54_0”)
  5. Execute .\bootstrap.bat
  6. Execute b2 address-model=64 toolset=msvc-11.0 --build-type=complete stage

If only certain libraries (for instance filesystem) are need step 6 can be replaced by this:

b2 address-model=64 toolset=msvc-11.0 --build-type=complete stage --with-filesystem --with-signals --with-system

I could not figure out what is working wrong. Any ideas?

Update Yesterday I tried again: I used the same commands and I finally got a 'libboost_filesystem-vc110-mt-gd-1_54.lib' file. No idea why it is working now. I installed a few VS2012 updates and also removed my VS2013 Preview installation. But I have no clue why it is working now.

4

1 回答 1

1

昨天我再次尝试:我使用了相同的命令,最终得到了一个“libboost_filesystem-vc110-mt-gd-1_54.lib”文件。不知道为什么它现在可以工作。我安装了一些 VS2012 更新并删除了我的 VS2013 Preview 安装。但我不知道为什么它现在可以工作。

于 2013-09-21T16:07:28.280 回答