我一直在嘗試構建BlockFactory,并且在嘗試構建它時不斷出現以下錯誤。
PS F:\simconnect-monitor\blockfactory> cmake -S . -B build
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19044.
-- The CXX compiler identification is MSVC 19.16.27045.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Matlab (missing: Matlab_MEX_LIBRARY Matlab_MX_LIBRARY ENG_LIBRARY) (found version "9.10")
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find Matlab (missing: Matlab_MEX_LIBRARY Matlab_MX_LIBRARY MX_LIBRARY) (found version "9.10")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
cmake/FindMatlab.cmake:1873 (find_package_handle_standard_args)
deps/mxpp/CMakeLists.txt:45 (find_package)
如您所見,已檢測到 MatLab,但找不到正確的庫。我試過 CMake 3.18.14 和 3.22.3 沒有區別。老實說,我現在真的很茫然。我在BlockFactory GitHub 上發布了一個問題,但到目前為止,它仍未解決。
uj5u.com熱心網友回復:
所以,我找到了解決方案。我正在使用 VS2017。默認情況下,對于 VS2017,cmake 會生成 32 位專案。您必須通過cmake -A x64才能將其強制為 64 位專案。不過,除此之外,我還必須強制 finfmatlab.cmake 只查找 64 位庫,方法是基本上設定_matlab_64build為始終為真。如果你這樣做,請確保你有 64 位 MatLab。
編輯:或者,您可以安裝 VS2019,因為它默認為 64 位專案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/456642.html
