I am following the tutorial text to setup OpenGL on Windows 11.
This is the main script(HelloWorld.cpp):
#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;
This is the c_cpp_properties.json file:
{
"configurations": [
{
"name": "GCC",
"includePath": ["${workspaceFolder}/**",
"C:\OpenGL\glfw.WIN64\include",
"C:\OpenGL\glew\include"
],
"defines": ["_DEBUG", "UNICODE", "_UNICODE"],
"windowsSdkVersion": "10.0.22000.0",
"compilerPath": "C:/msys64/mingw64/bin/g++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
This is the launch.json file:
{
"configurations": [
{
"name": "C/C++: g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\msys64\ucrt64\bin\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
],
"version": "2.0.0"
}
This is the tasks.json file:
{
"tasks": [
{
"label": "C/C++: g++.exe build active file",
"type": "cppbuild",
"command": "C:\msys64\ucrt64\bin\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\${fileBasenameNoExtension}.exe",
"-I",
"C:\OpenGL\glfw.WIN64\include",
"-I",
"C:\OpenGL\glew\include",
"-L",
"C:\OpenGL\glew\lib\Release\x64",
"-L",
"C:\OpenGL\glfw.WIN64\lib-mingw-w64",
"-lglfw3dll",
"-lglew32",
"-lopengl32"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
And this is the settings.json file that you get when opening Code Runner: Executor Map in the settings:
{
"code-runner.runInTerminal": false,
"workbench.colorTheme": "Default Dark+",
"editor.fontSize": 11,
"editor.autoClosingBrackets": "always",
"editor.autoClosingComments": "always",
"editor.autoClosingQuotes": "always",
"cmake.showOptionsMovedNotification": false,
"C_Cpp.default.includePath": [
"/usr/include"
],
"code-runner.executorMap": {
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt -I C:\OpenGL\glfw.WIN64\include -I C:\OpenGL\glew\include -L C:\OpenGL\glew\lib\Release\x64 -L C:\OpenGL\glfw.WIN64\lib-mingw-w64 -lglfw3dll -lglew32 -lopengl32 && ./$fileNameWithoutExt",
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"zig": "zig run",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "python -u",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runghc",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded",
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
"FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"sml": "cd $dir && sml $fileName",
"mojo": "mojo run",
"erlang": "escript",
"spwn": "spwn build",
"pkl": "cd $dir && pkl eval -f yaml $fileName -o $fileNameWithoutExt.yaml",
"gleam": "gleam run -m $fileNameWithoutExt"
}
}
Trying to run the program results in the following output:
[Running] cd “c:Users[MyUsername]DokumenteC++OpenGL-Setup” && g++ HelloWorld.cpp -o HelloWorld -I C:OpenGLglfw.WIN64include -I C:OpenGLglewinclude -L C:OpenGLglewlibReleasex64 -L C:OpenGLglfw.WIN64lib-mingw-w64 -lglfw3dll -lglew32 -lopengl32 && ./HelloWorld
Der Befehl “.” ist entweder falsch geschrieben oder
konnte nicht gefunden werden. [Basically the command “.” is either spelled incorrectly or could not be found.]
[Done] exited with code=1 in 1.264 seconds
I’m pretty sure it’s referring to ‘./$fileNameWithoutExt”,’ but because I don’t understand the line myself, I can’t really fix it…
I’ve tried just building the file to see if that works, this time it outputs the following:
- Executing task: C/C++: g++.exe build active file
Starting build…
cmd /c chcp 65001>nul && C:msys64ucrt64bing++.exe -fdiagnostics-color=always -g C:Users[MyUsername]DokumenteC++OpenGL-SetupHelloWorld.cpp -o C:Users[MyUsername]DokumenteC++OpenGL-SetupHelloWorld.exe -I C:OpenGLglfw.WIN64include -I C:OpenGLglewinclude -L C:OpenGLglewlibReleasex64 -L C:OpenGLglfw.WIN64lib-mingw-w64 -lglfw3dll -lglew32 -lopengl32
Der Befehl “C:msys64ucrt64bing++.exe” ist entweder falsch geschrieben oder
konnte nicht gefunden werden. [The command “C:msys64ucrt64bing++.exe” is either spelled incorrectly or could not be found.]
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 can compile programs that don’t use OpenGL and I can run them within VS Code too..
Does anyone know what I can do?
Thank you in advance!
Yesko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.