Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

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:

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;
}

When compiled (32 bit) I receive this error:

......\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

I also have the error "cannot open source file stdio.h" when hovering over the include statement for 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 :)

Cheers and thanks for your time.

like image 996
gabriel Avatar asked Jul 20 '16 06:07

gabriel


1 Answers

Suggestions: Use the dropdown, (inherit from parent or project defaults) to repair the visual c++ directories which you shouldn't ever edit.

Don't add it to the c++ directories, That's a weird idea. Add it to Configuration Properties > c/c++ > additional include directories. 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. Maybe I just couldn't find the VS2015 guide...

like image 117
zeromus Avatar answered Sep 20 '22 08:09

zeromus