+ 1

Why does this produce a fatal error?

I'm trying to get SDL2 to work with VS Code and MinGW. In the sdl folder, there are 2 other folders, include and lib. They contain all the files I need to use SDL. I have put said sdl folder in the bin for my MinGW directory. The bin contains all the files necessary to compile c++, so I put all my c++ projects in that directory. The error I got from the console when I tried to #include <sdl/include/SDL.h> was: "fatal error: no such directory exists". At runtime, the console navigates to the bin because that is where the file I'm trying to run is, so I thought putting the sdl folder in the bin would validate its directory, but that doesn't seem to be the case. Does anyone have any idea what is wrong and how I can fix it?

20th Aug 2018, 11:22 PM
jacksonofgames 28
jacksonofgames 28 - avatar
4 Respostas
+ 1
#include "sdl/include/SDL.h" would be the right way to do this. You can also right click the folder with the name of your project in the solution explorer and go to properties. There, you go to Configuration Properties->VC++ Directories, edit the Include Directories and add the folder "include". If you do this you can simply type #include <SDL.h> In addition, some other steps are necessary to set up the SDL. For a precise description, just read this tutorial: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvsnet2010u/index.php
20th Aug 2018, 11:54 PM
Theresa
Theresa - avatar
0
Thank you so much for your response Theresa, but I think you might be describing how to do it on Visual Studio. I'm using Visual Studio Code. (My computer doesn't have enough space for Visual Studio), although I will try the #include (with the quotes) tomorrow. (Been a long day). Thanks again!
21st Aug 2018, 2:16 AM
jacksonofgames 28
jacksonofgames 28 - avatar
0
hello guys , I start my work about learn cpp can you help me?
21st Aug 2018, 8:24 AM
Mr Leen
Mr Leen - avatar
0
Sure, what do you want to know? (BTW, thanks so much Theresa. I don't know why I didn't think to include with quotes for a .h file)
21st Aug 2018, 11:49 PM
jacksonofgames 28
jacksonofgames 28 - avatar