[英]C++ SDL (Visual Studio 2015): cannot open file stddef.h
I'm relatively new to c++ and have been following the Lazy Foo' tutorial for installing SDL2 in visual studio 2010 (But I am using visual studio 2015). 我对c ++比较陌生,并且一直在关注在Visual Studio 2010中安装SDL2的Lazy Foo教程(但我使用的是visual studio 2015)。
I have followed the guide a couple of times now, so pretty certain I have incuded the right files etc. Here is a screen shot of my VC++ Directories settings: 我现在已经按照指南做了几次,所以很确定我已经包含了正确的文件等。这是我的VC ++目录设置的屏幕截图:
#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;
}
When compiled (32 bit) I receive this error: 编译时(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
...... \\ documents \\ sdl \\ sdl2-2.0.4 \\ include \\ sdl_stdinc.h(50):致命错误C1083:无法打开包含文件:'stddef.h':没有这样的文件或目录
I also have the error "cannot open source file stdio.h" when hovering over the include statement for stdio.h 当鼠标悬停在stdio.h的include语句上时,我也有错误“无法打开源文件stdio.h”
I'm going to continue to look at it all, but if anyone has any suggestions that would be greatly appreciated. 我将继续关注这一切,但如果有人有任何建议会非常感激。 Failing that I'll probably just install on Linux :)
如果失败我可能只是在Linux上安装:)
Cheers and thanks for your time. 干杯谢谢你的时间。
Suggestions: Use the dropdown, (inherit from parent or project defaults) to repair the visual c++ directories which you shouldn't ever edit. 建议:使用下拉列表(从父项目或项目默认值继承)来修复您不应编辑的visual c ++目录。
Don't add it to the c++ directories, That's a weird idea. 不要将它添加到c ++目录中,这是一个奇怪的想法。 Add it to Configuration Properties > c/c++ > additional include directories.
将其添加到配置属性> c / c ++>其他包含目录。 If you had done that, then you couldn't have possibly messed up the compiler.
如果您已经这样做了,那么您可能无法搞砸编译器。 It's a lot simpler too.
它也简单得多。 Just paste the one directory in there.
只需粘贴一个目录即可。 That's what it's meant for.
这就是它的意思。
Also Lazy Foo seems to only to have a VS2010 guide. 另外,Lazy Foo似乎只有VS2010指南。 Maybe I just couldn't find the VS2015 guide...
也许我找不到VS2015指南......
The error message 错误消息
fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
致命错误C1083:无法打开包含文件:'stddef.h':没有这样的文件或目录
tends to happen when you're building your program with a version of MSVC different from the one used to build the library. 当您使用与用于构建库的版本不同的MSVC版本构建程序时,往往会发生这种情况。
You should find out which version the SDL binaries were built with, and try using that. 您应该找出构建SDL二进制文件的版本,并尝试使用它。 A newer MSVC might work, an older one might not.
较新的MSVC可能有效,较旧的MSVC可能无效。
You can always try building SDL yourself. 您可以随时尝试构建SDL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.