I'm new to Vulkan and trying to recreate what the tutorial from the webpage showed me, i'm using VS Code and the error showed up when trying to compile, it showed that GLFW/glfw3.h not found even though i include it to my project in the includePath
in the c_cpp_properties.json
.
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/src/**",
"${workspaceFolder}/lib/**",
"${workspaceFolder}/include/**",
"${workspaceFolder}/lib/glfw/lib-mingw-w64/**",
"C:/VulkanSDK/1.2.182.0/Lib/**",
"C:/VulkanSDK/1.2.182.0/Include/**",
"C:/Users/___/scoop/apps/llvm/current/lib/clang/12.0.1/include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/Users/___/scoop/shims/clang++.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-clang-x64",
"macFrameworkPath": [],
"forcedInclude": [
"${workspaceFolder}/include/GLFW/glfw3.h"
]
}
],
"version": 4
}
main.cpp
// Code from the tutorial
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/vec4.hpp>
#include <glm/mat4x4.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;
}
I already double-check the file path to make sure it's right but the error still appear and i also tried #include <vulkan/vulkan.h>
instead of #define GLFW_INCLUDE_VULKAN
and it showed that 'vulkan/vulkan.h' file not found
What you're doing is with c_cpp_properties.json
is only for the IDE / intellisense. You have to pass the include paths to the compiler as well in your tasks.json
, because the compiler needs to know about them, too.