提问人:HacksReported 提问时间:10/18/2023 最后编辑:drescherjmHacksReported 更新时间:10/18/2023 访问量:70
使用 CLion 和 vcpkg 安装 SDL2 时出现问题 [已关闭]
Issue with installing SDL2 using CLion and vcpkg [closed]
问:
====================[ Build | main | Debug ]====================================
C:\Users\Amund\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe --build C:\Users\Amund\Desktop\main\cmake-build-debug --target main -j 14
[1/1] Linking CXX executable main.exe
FAILED: main.exe
cmd.exe /C "cd . && C:\Users\Amund\AppData\Local\Programs\CLion\bin\mingw\bin\g++.exe -g CMakeFiles/main.dir/main.cpp.obj -o main.exe -Wl,--out-implib,libmain.dll.a -Wl,--major-image-version,0,--minor-image-version,0 vcpkg_installed/x64-windows/debug/lib/manual-link/SDL2maind.lib vcpkg_installed/x64-windows/debug/lib/SDL2d.lib -lshell32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cmd.exe /C "cd /D C:\Users\Amund\Desktop\main\cmake-build-debug && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/Users/Amund/.vcpkg-clion/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/Amund/Desktop/main/cmake-build-debug/main.exe -installedDir C:/Users/Amund/Desktop/main/cmake-build-debug/vcpkg_installed/x64-windows/debug/bin -OutVariable out""
Warning: corrupt .drectve at end of def file
C:\Users\Amund\AppData\Local\Programs\CLion\bin\mingw\bin/ld.exe: vcpkg_installed/x64-windows/debug/lib/manual-link/SDL2maind.lib(CMakeFiles/SDL2main.dir/src/main/windows/SDL_windows_main.c.obj):(.text$mn+0x290): undefined reference to `_RTC_CheckStackVars'
C:\Users\Amund\AppData\Local\Programs\CLion\bin\mingw\bin/ld.exe: vcpkg_installed/x64-windows/debug/lib/manual-link/SDL2maind.lib(CMakeFiles/SDL2main.dir/src/main/windows/SDL_windows_main.c.obj):(.rtc$IMZ+0x0): undefined reference to `_RTC_InitBase'
C:\Users\Amund\AppData\Local\Programs\CLion\bin\mingw\bin/ld.exe: vcpkg_installed/x64-windows/debug/lib/manual-link/SDL2maind.lib(CMakeFiles/SDL2main.dir/src/main/windows/SDL_windows_main.c.obj):(.rtc$TMZ+0x0): undefined reference to `_RTC_Shutdown'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
使其在不列出错误的情况下进行编译
答:
1赞
drescherjm
10/18/2023
#1
输出中显示的三元组:文件夹为 msvc 构建二进制文件,这些二进制文件大多与基于 c++ 的代码的 MinGW 不兼容。您在此处使用 MinGW:vcpkg 中有 MinGW 三胞胎。您需要使用它们来构建 MinGW。x64-windows
vcpkg_installed/x64-windows/debug/lib
C:\Users\Amund\AppData\Local\Programs\CLion\bin\mingw\bin\g++.exe
评论
2赞
user4581301
10/18/2023
如果 mingw 是随 MSYS2 一起安装的,则可以使用 MSYS2 的包管理器来安装许多库的兼容版本,包括 SLD2
评论
x64-windows
vcpkg_installed/x64-windows/debug/lib
C:\Users\Amund\AppData\Local\Programs\CLion\bin\mingw\bin\g++.exe
vcpkg