简体   繁体   English

带有SDL2问题的Visual Studio代码

[英]Visual studio code with SDL2 problems

I am trying to get SDL2 working with visual studio code and it seems like it can't find the header files. 我正在尝试使SDL2与Visual Studio代码一起使用,似乎找不到头文件。

This is the error I get in the Terminal. 这是我在终端中遇到的错误。

Executing task: C:/MinGW/bin/g++ C:\Users\codyc\Desktop\SDL\SDL2-2.0.8\i686-w64-mingw32\bin C:\Users\codyc\Desktop\SDL\SDL2-2.0.8\i686-w64-mingw32\include\SDL2 C:\Users\codyc\Desktop\SDL\SDL2-2.0.8\i686-w64-mingw32\lib <
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find C:\Users\codyc\Desktop\SDL\SDL2-2.0.8\i686-w64-mingw32\bin: Permission denied
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find C:\Users\codyc\Desktop\SDL\SDL2-2.0.8\i686-w64-mingw32\include\SDL2: Permission denied
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find C:\Users\codyc\Desktop\SDL\SDL2-2.0.8\i686-w64-mingw32\lib: Permission denied
collect2.exe: error: ld returned 1 exit status
The terminal process terminated with exit code: 1

Installing a open source library like SDL2 for windows development and doing cross-compiling with tools like mingw32 could be quite challenging for starters. 对于初学者来说,安装用于Windows开发的开源库(如SDL2)并使用mingw32之类的工具进行交叉编译可能会非常困难。

It is recommended to download vcpkg, which is a open source packager for visual studio C++, from GitHub. 建议从GitHub下载vcpkg,这是Visual Studio C ++的开源打包程序。 Once installed, you can import many such projects through Powershell command line. 安装后,您可以通过Powershell命令行导入许多此类项目。 In your case it will look something like this : .\\vcpjg install sdl2:x64-windows-static 在您的情况下,它将看起来像这样: .\\vcpjg install sdl2:x64-windows-static

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM