gpt4 book ai didi

C++ SDL (Visual Studio 2015) : cannot open file stddef. h

转载 作者:太空狗 更新时间:2023-10-29 20:54:38 35 4
gpt4 key购买 nike

我对 c++ 比较陌生,一直在按照 Lazy Foo 的教程在 visual studio 2010 中安装 SDL2(但我使用的是 visual studio 2015)。

我现在已经按照指南进行了几次,所以很确定我已经包含了正确的文件等。这是我的 VC++ 目录设置的屏幕截图:

enter image description here

VC++ Directories settings screen shot

#include <SDL.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window *window = 0;
window = SDL_CreateWindow("SDL window",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
640, 480,
SDL_WINDOW_SHOWN);
SDL_Delay(1000);
SDL_DestroyWindow(window);
SDL_Quit();

return 0;
}

编译时(32 位)我收到此错误:

......\documents\sdl\sdl2-2.0.4\include\sdl_stdinc.h(50): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory

当鼠标悬停在 stdio.h 的包含语句上时,我也遇到错误“无法打开源文件 stdio.h”

我将继续研究这一切,但如果有人有任何建议,我将不胜感激。如果失败,我可能只会在 Linux 上安装 :)

干杯,感谢您的宝贵时间。

最佳答案

建议:使用下拉列表(继承自父项或项目默认值)来修复您永远不应编辑的 Visual C++ 目录。

不要将它添加到 c++ 目录,这是一个奇怪的想法。将其添加到 Configuration Properties > c/c++ > additional include directories。如果你这样做了,那么你就不可能搞砸了编译器。它也简单了很多。只需将一个目录粘贴到那里。这就是它的意义所在。

而且 Lazy Foo 似乎只有一个 VS2010 指南。也许我只是找不到 VS2015 指南...

关于C++ SDL (Visual Studio 2015) : cannot open file stddef. h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38473643/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com