1

I'm working in a Visual Studio Project that was generated using CMake, and for some reason, I get an LNK1104 error on build saying "cannot open file 'hboost_python27-vc142-mt-x64-1_72.lib'" and I know for a fact that that file does not exist anywhere and that the correct dependency is "hboost_python27-mt-x64.lib." So why is Visual Studio asking for this file? How would I go about deriving where this filename is coming from, and then fixing it? Is this more of a CMake issue? Or a Visual Studio issue?

For reference, I'm compiling a custom USD Asset Resolver for Houdini, and here is the code I was working on https://github.com/mwalk176/USD-Custom-Resolver-Windows-Example/tree/main/custom_resolver/project

  • Probably a `#pragma comment (lib ...` in the headers. – drescherjm Dec 18 '21 at 23:24
  • Note that USD itself has a dependency on boost. Do not mix different boost libraries. Use [vcpkg](https://github.com/microsoft/vcpkg) instead. – Osyotr Dec 18 '21 at 23:25
  • I'm trying to compile it against Houdini's internal implementation of USD and boost, but would that still require vcpkg? – Matthew Walker Dec 19 '21 at 00:00
  • The only #pragma comment is a `#pragma once` in the main header of my code, would that cause it? – Matthew Walker Dec 19 '21 at 00:02
  • @drescherjm Update: Found a `#pragma comment (lib...)` in one of the included header files that seems to be causing it. It has the format `pragma comment(lib, HBOOST_LIB_PREFIX HBOOST_STRINGIZE(HBOOST_LIB_NAME) "-" HBOOST_LIB_TOOLSET HBOOST_LIB_THREAD_OPT HBOOST_LIB_RT_OPT HBOOST_LIB_ARCH_AND_MODEL_OPT "-" HBOOST_LIB_VERSION ".lib")`, how would I set these variables within the VS2019 environment? – Matthew Walker Dec 19 '21 at 01:08

1 Answers1

0

I think you have quite old version of Boost installed on your PC, starting from quite recent versions of Boost it is a standard way to write more verbose syntax like hboost_python27-vc142-mt-x64-1_72.lib, so it is correct.

Try downloading Boost 1.72 from here or if your code is compatible with more recent versions of Boost then it is better to download latest version which is 1.78 download right now.

Otherwise in your file system copy file hboost_python27-mt-x64.lib over to hboost_python27-vc142-mt-x64-1_72.lib, or make Windows hard link. This way it will be found when compiling.

Another option is that you modify your current code

#pragma comment(lib, HBOOST_LIB_PREFIX HBOOST_STRINGIZE(HBOOST_LIB_NAME) "-" \
    HBOOST_LIB_TOOLSET HBOOST_LIB_THREAD_OPT HBOOST_LIB_RT_OPT \
    HBOOST_LIB_ARCH_AND_MODEL_OPT "-" HBOOST_LIB_VERSION ".lib")

to shorter version:

#pragma comment(lib, HBOOST_LIB_PREFIX HBOOST_STRINGIZE(HBOOST_LIB_NAME) "-" \
    HBOOST_LIB_THREAD_OPT HBOOST_LIB_RT_OPT HBOOST_LIB_ARCH_AND_MODEL_OPT ".lib")

after this change this pragma code will produce expected file name hboost_python27-mt-x64.lib.

Arty
  • 14,883
  • 6
  • 36
  • 69