Search code examples
c++makefilevulkan

vkEnumerateInstanceExtensionProperties was not declared in this scope


I'm trying to setup a development environment for Vulcan in Ubuntu 22, following the tutorial https://vulkan-tutorial.com/Development_environment#page_Linux.

I'm getting an error

error: ‘vkEnumerateInstanceExtensionProperties’ was not declared in this scope
   19 |   vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);

My code:

#define GLFW_INCLUDE_VULCAN
#include <GLFW/glfw3.h>

#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include "glm/mat4x4.hpp"
#include "glm/vec4.hpp"

#include <iostream>

int main() {
  glfwInit();

  glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
  GLFWwindow *window =
      glfwCreateWindow(800, 600, "Vulkan window", nullptr, nullptr);

  uint32_t extensionCount = 0;
  vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);

  std::cout << extensionCount << " extensions supported\n";

  glm::mat4 matrix;
  glm::vec4 vec;
  auto test = matrix * vec;

  while (!glfwWindowShouldClose(window)) {
    glfwPollEvents();
  }
  glfwDestroyWindow(window);
  glfwTerminate();
  return 0;
}

Makefile:

CFLAGS = -std=c++17 -O2
LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi

VulkanTest: main.cpp
    g++ $(CFLAGS) -o VulkanTest main.cpp $(LDFLAGS)

.PHONY: test clean

test: VulkanTest
    ./VulkanTest

clean:
    rm -f VulkanTest

What am I missing?

I installed all required libraries and GLFW is importing correctly


Solution

  • This is a typo.

    It's spelled Vulkan. Vulcan with a c is something a bit more round and much bigger.

    Spell your GLFW_INCLUDE_VULCAN correctly (GLFW_INCLUDE_VULKAN) and this should complile fine.