glfwCreateWindowSurface - always return -7


Hello there,

After several test, always the method glfwCreateWindowSurface returns me -7.

Following the documentation If I get glfwGetRequiredExtension it gaves me: VK_KHR_surface, VK_KHR_xcb_surface. Which It appears to be correct.

My rig>

Fedora21, glfw (latest one), Vulkan API Version: 1.0.30, Nvidia driver> Driver Version: 367.44 Quadro k4200

If I run vulkanInfo>

Presentable Surface formats:

GPU id : 0 (K4200)
Surface type : VK_KHR_xcb_surface
Format count = 2

GPU id : 0 (K4200)
Surface type : VK_KHR_xlib_surface
Format count = 2

My current project:

The glfw surface call is under vKwindow.cpp class.

Any idea is really welcome.


A return of -7 is VK_ERROR_EXTENSION_NOT_PRESENT, which is the same error as seen in this post, which was apparently solved by linking to the vulkan libraries

Alternatively, have you been able to build and run the vulkan.c test? This would be a good starting point.


Ops @dougbinks, I didn’t see these post. Sorry about that. Yes, I’ve compiled and It’s running the vulkan.c test…

I’ve installed the vulkan libraries in a non common place>


Not sure if it’s maybe the problem, I’ve attached here too, my eclipse c++ config…


I take it the vulkan test works and you get a window with a triangle and no error output?

What does your code vKdevice::fillExtensionsProperties output for the list of extensions you found?


It makes nothing, I’m not using it (old code) I need remove it…

But if I print what I obtain from vkEnumerateInstanceExtensionProperties , I get>


For fill the structure, I’m using this method:

std::vector<const char*> vKlayers::getRequiredExtensions(){

std::vector<const char*> extensions;

unsigned int glfwExtensionCount = 0;
const char** glfwExtensions;

glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);

for (unsigned int i = 0; i<glfwExtensionCount;i++){
if (this->vKlayersEnable){
return extensions;

}Preformatted text


If you ran that code from within the same program you can’t create a window from then it sounds like you have the build set up correctly, and since the vulkan.c test works it appears that GLFW is working as expected. So there’s likely an error in your code.

I don’t have the time to check through your sample code thoroughly (I’ve taken a quick look but haven’t seen anything obvious and I only have Vulkan available on a Windows machine), so I’d advise first creating a simple example using the vulkan.c test code from GLFW in your own project, then once this is running you can re-write it to make your own base code.


Have you initialized GLFW before calling glfwGetRequiredInstanceExtensions? If not, it will return all zeroes, which your code will interpret as an empty array. Set a GLFW error callback and see if it complains about anything.


Thanks @elmindreda, I setup it, and I get> X11: Vulkan instance missing VK_KHR_xcb_surface extension

I’m still figure out what happen, because I’ve compiled some demos, and It’s working, so It’s something that I’m making wrong I guess… :frowning:


Found the crash!, My bad with the device pointer :slight_smile:.

Thanks @elmindreda for the error callback , it helps a lot to me to found the problem.