I used the command: g++ -std=c++17 -o triangle 15_hello_triangle.cpp -lglfw3 -lvulkan -lwinmm -lgdi32 -Wl,--subsystem,windows
and it compiles and links without any error or warning messages, but when I run it, the program blank window splashes and on the console I get the message:
failed to create window surface!
Any help with what is the cause is appreciated, no I haven’t edited the source just copy paste verbatim from the web site…
Well, I modified the code as follows (the function createSurface), replaced glfwCreateWindowSurface by its implementation for windows mentioned in the tutorial so it became:
I am still wondering is this a bug in glfw and is it just for windows or also on mac and linux. Is there a better way around it? is there a patch that fixes it.
and just trying both versions on Microsoft Visual studio Community 2017 neither work.
I had to get over complaining about std::optional with a primitive type as template parameter from Microsoft compiler to get it to compile. Anyone was able to get the tutorial example working (either version) on Visual studio.
Well here is another cpp program that has the same issue. I don’t think this problem is specific to this one cpp program which is well written and clear enough. I believe that it has to do with dealing with cpp that glfwCreateWindowSurface has an issue. If you go to this link:
and download the squareVulkanized program, a program written by the author of an opengl textbook that illustrates vulkan by drawing a static square to compare it with opengl…
It has the exact same problem as the hello triangle program in the tutorial. First this program gives a segmentation fault, and upon replacing glfwCreateWindowSurface by the same exact code that I used in the working version of hello triangle in mingw64, the program runs fine…
It could be nasty problems with pointers when switching between C and C++ or whatever in glfwCreateWindowSurface. Anyway I posted my message in glfw forum and got some replies but not much of help either…I don’t have access to Mac or Linux machines (I need windows for better Arabic support for my professional work rather than Linux), and posted on the hope that someone with such access would try and let me know…
I presume you are asking for GLFW version. It is the latest release, just download it and build it for VS for the squarevulkanized program that runs in VS. In MSYS2 it is up to date to 3.2