Finding the source of LNK1104's filename

87 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.