wxhelper
wxhelper copied to clipboard
编译失败 "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx86/x86/cl.exe" is not able to compile a simple test program.
编译失败
C:\wxhelper\build>cmake -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_ASM_MASM_COMPILER=ml64.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=C:/wxhelper/install/x64-debug -DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -S=c:/wxhelper -B=c:/wxhelper/build/x64-debug -G Ninja
-- The C compiler identification is MSVC 19.39.33523.0
-- The CXX compiler identification is MSVC 19.39.33523.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx86/x86/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/CMakeTestCXXCompiler.cmake:60 (message):
The C++ compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx86/x86/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: 'C:/wxhelper/build/x64-debug/CMakeFiles/CMakeScratch/TryCompile-5o93lr'
Run Build Command(s): C:/ProgramData/chocolatey/bin/ninja.exe -v cmTC_2c3f3
[1/2] C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx86\x86\cl.exe /nologo /TP /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -MDd -Zi /showIncludes /FoCMakeFiles\cmTC_2c3f3.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_2c3f3.dir\ /FS -c C:\wxhelper\build\x64-debug\CMakeFiles\CMakeScratch\TryCompile-5o93lr\testCXXCompiler.cxx
FAILED: CMakeFiles/cmTC_2c3f3.dir/testCXXCompiler.cxx.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx86\x86\cl.exe /nologo /TP /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -MDd -Zi /showIncludes /FoCMakeFiles\cmTC_2c3f3.dir\testCXXCompiler.cxx.obj /FdCMakeFiles\cmTC_2c3f3.dir\ /FS -c C:\wxhelper\build\x64-debug\CMakeFiles\CMakeScratch\TryCompile-5o93lr\testCXXCompiler.cxx
x64
c1xx: fatal error C1083: 无法打开源文件: “C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64”: No such file or directory
正在生成代码...
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
编译器架构是x86,用x64的编译器
是按以下操作说明执行的:
环境: cl.exe目录= c:/cl.exe
ml64.exe目录 =c:/ml64.exe
vcpkg目录 = c:/vcpkg wxhelper目录 = c:/wxhelper
cd wxhelper/app/3rdparty
git clone https://github.com/microsoft/Detours.git
git clone https://github.com/gabime/spdlog.git
git clone https://github.com/nlohmann/json.git
或者使用vcpkg 安装相应库
vcpkg install detours:x64-windows
vcpkg install nlohmann-json:x64-windows
vcpkg install spdlog:x64-windows
cd wxhelper/cmake
copy detours.cmake wxhelper/app/3rdparty/Detours/CMakeLists.txt
cd wxhelper
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=cl.exe \
-DCMAKE_CXX_COMPILER=cl.exe \
-DCMAKE_ASM_MASM_COMPILER=ml64.exe \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=C:/wxhelper/install/x64-debug \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
-SC:c:/wxhelper \
-BC:c:/wxhelper/build/x64-debug\
-G Ninja
cmake --build ..
自动就变成 C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx86/x86/cl.exe
不知道如何修改了
这里的 cl.exe目录= c:/cl.exe ml64.exe目录 =c:/ml64.exe 是需要把这两个exe copy到c盘吗?这里是不是该通过设置环境变量调用本机的程序呢?
首先,确保你的系统已经安装了cmake和Ninja构建系统,并且cl.exe和ml64.exe路径正确。
-
切换到
wxhelper
项目里的3rdparty
目录,并克隆相关的依赖库:cd c:/wxhelper/app/3rdparty git clone https://github.com/microsoft/Detours.git git clone https://github.com/gabime/spdlog.git git clone https://github.com/nlohmann/json.git
或者使用vcpkg安装这些依赖库:
c:/vcpkg/vcpkg install detours:x64-windows c:/vcpkg/vcpkg install nlohmann-json:x64-windows c:/vcpkg/vcpkg install spdlog:x64-windows
-
将Detours的CMake配置文件复制到正确位置:
cd c:/wxhelper/cmake copy detours.cmake c:/wxhelper/app/3rdparty/Detours/CMakeLists.txt
-
为
wxhelper
项目创建一个构建目录:cd c:/wxhelper mkdir build cd build
-
配置项目:
注意:cmake路径中的大小写需要与实际路径匹配。
cmake -DCMAKE_C_COMPILER=c:/cl.exe \ -DCMAKE_CXX_COMPILER=c:/cl.exe \ -DCMAKE_ASM_MASM_COMPILER=c:/ml64.exe \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=c:/wxhelper/install/x64-debug \ -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake \ -Hc:/wxhelper \ -Bc:/wxhelper/build/x64-debug \ -G "Ninja"
-
构建项目:
cmake --build c:/wxhelper/build/x64-debug
请确保替换命令中的路径以匹配你的环境。
以上是使用gpt4优化后的步骤,可以在此基础上优化后更新
这个报错怎么解决啊
这个报错怎么解决啊
同样卡在这里,哪位大佬,方便的话,指点一下,感谢~!
这个报错怎么解决啊
同样卡在这里,哪位大佬,方便的话,指点一下,感谢~!
@ttttupup 大佬,有空,帮忙解答一下,感谢~!
基本可以成功的编译说明 https://www.yuque.com/atorber/chatflow/dax7igc31bpi949h