For the following GLFW hello example in Visual Studio Code:

include <GLFW/glfw3.h>

int main(void)  
    GLFWwindow* window;  
    /* Initialize the library */  
    if (!glfwInit())  
        return -1;  
    /* Create a windowed mode window and its OpenGL context */  
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);  
    if (!window)  
        glfwTerminate();  
        return -1;  
    /* Make the window's context current */  
    glfwMakeContextCurrent(window);  
    /* Loop until the user closes the window */  
    while (!glfwWindowShouldClose(window))  
        /* Render here */  
        glClear(GL_COLOR_BUFFER_BIT);  
        /* Swap front and back buffers */  
        glfwSwapBuffers(window);  
        /* Poll for and process events */  
        glfwPollEvents();  
    glfwTerminate();  
    return 0;  

c_cpp_properties.json:

"configurations": [ "name": "Win32", "includePath": [ "${workspaceFolder}/", "C:\Program Files\GLFW\include\" "defines": [ "_DEBUG", "UNICODE", "_UNICODE" "windowsSdkVersion": "10.0.22000.0", "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "windows-msvc-x64" "version": 4

launch.json:

"configurations": [ "name": "C/C++: cl.exe build and debug active file", "type": "cppvsdbg", "request": "launch", "program": "${fileDirname}\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "console": "externalTerminal", "preLaunchTask": "C/C++: cl.exe build active file" "version": "2.0.0"

tasks.json:

"tasks": [ "type": "cppbuild", "label": "C/C++: cl.exe build active file", "command": "cl.exe", "args": [ "/IC:\Program Files\GLFW\include", "/IC:\Program Files\GLFW\lib-vc2022", "/Zi", "/EHsc", "/nologo", "/Fe${fileDirname}\${fileBasenameNoExtension}.exe", "${file}", "/link glfw3.lib" "options": { "cwd": "${fileDirname}" "problemMatcher": [ "$msCompile" "group": { "kind": "build", "isDefault": true "detail": "Task generated by Debugger." "version": "2.0.0"

from terminal I have:

Starting build...
cl.exe "/IC:\Program Files\GLFW\include" "/IC:\Program Files\GLFW\lib-vc2022" /Zi /EHsc /nologo /FeC:\Users\prusso\projects\helloworld\helloworld.exe C:\Users\prusso\projects\helloworld\helloworld.cpp "/link glfw3.lib"
helloworld.cpp
C:\Program Files\GLFW\include\GLFW/glfw3.h(103): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory

Build finished with error(s).

  • The terminal process failed to launch (exit code: -1).
  • Terminal will be reused by tasks, press any key to close it.

    I did install in addition to Visual Studio Code, Visual Studio Community Edition with Desktop C++ support.
    How come a missing stddef.h? Thanks...

    Hi @Phillip Russo ,

    Regarding VS Code-related issues, I suggest you ask questions on Github.

    If Visual Studio also has this problem, I suggest you first check if the header file exists on your computer, then add it to Configuration Properties > c/c++ > additional include directories. If not, try to get it on the Internet.

    Do you have Windows SDK installed? If not, please install it in Visual Studio Installer. If your operating system is Win10, then download the Windows 10 SDK.

    Best regards,

    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    So in terms of stddef.h I was able to fine an x86 version of it that is part of a Visual Studio Community edition installation that one can fine by:

    dir /S "stddef.h"

    in a command prompt window. The issue with compiling for GLFW that still exists is that since an x64 version of stddef.h wasn't installed or installed yet for me that I get a cross compilation error about mixing x86 and x64 libraries to link to. So since that a 32-bit compile isn't what I was looking for that leaves me looking for maybe another way to GLFW other than cl.exe just for right now. I would maybe like to hear from others about that if there is an x64 bit flavor of stddef.h that maybe is available? So if GLFW does compile in 32-bit fashion I wouldn't know yet but it sounds like MinGW is a better bet for a GLFW source code in terms of compiling it.

  •