Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

Vscode and header files and other stuff/issues .... need help

recentely i switched form the one and only "turbo c++" to "vs code" and mingw w64 compiler and i am damm happy with it and its totally a chill flow while i write my "c"(nope not c++) programs. so now for my university i had to use graphics.h header for completing my university assingments and looking up on the internet i find SDL and after copying all files in my proper compiler directory.vs code says that the 

 

#include "SDL/SDL.h"
 
is not availabele
or as vs code says 
 
{
"resource": "/c:/Users/Apratim Ray/Documents/AOA/Siomon-says/simon.c",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "cannot open source file \"SDL/SDL.h\"",
"startLineNumber": 3,
"startColumn": 1,
"endLineNumber": 3,
"endColumn": 21
}
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>

//this is the code i pasted it in

int main( int argc, char* args[] )
{
    //Start SDL
    SDL_Init( SDL_INIT_EVERYTHING );
    
    //Quit SDL
    SDL_Quit();
    
    return 0;    
}
and yes i copied in all the .a and .h and .dll files properly (i think so ??????)
2 Replies
Copilot Lvl 2
Message 2 of 3

Re: Vscode and header files and other stuff/issues .... need help

and these are my vscode's json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\compiler\\mingw64\\bin\\gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}
Commander Lvl 1
Message 3 of 3

Re: Vscode and header files and other stuff/issues .... need help

Not a VS Code expert, but pretty sure you need to add the SDL include folder to your include path settings in the JSON file.

This:

            "includePath": [
                "${workspaceFolder}/**"
            ],

to something liike:

            "includePath": [
                "${workspaceFolder}/**",
                "C:\path_to_SDL_includes"
            ],

(borrowing from stack-overflow).

Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!