I'm trying to use GLFW in Visual Studio for a Vulkan project.
After all the include statements the code still shows some errors, all of which are related to GLFW library inclusion.
And one error(the last one below) has "stdafx.h" error.
I have no idea what stdafx.h is.
I'm posting the Code and the errors.
Can someone help me with this?
#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" << std::endl;
glm::mat4 matrix;
glm::vec4 vec;
auto test = matrix * vec;
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
Severity Code Description Project File Line Suppression State Error (active) E1696 cannot open source file "GLFW/glfw3.h" VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 2
Error (active) E0020 identifier "glfwInit" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 9
Error (active) E0020 identifier "glfwWindowHint" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 10
Error (active) E0020 identifier "GLFW_CLIENT_API" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 10
Error (active) E0020 identifier "GLFW_NO_API" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 10
Error (active) E0020 identifier "GLFWwindow" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 11
Error (active) E0020 identifier "window" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 11
Error (active) E0020 identifier "glfwCreateWindow" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 11
Error (active) E0020 identifier "vkEnumerateInstanceExtensionProperties" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 13
Error (active) E0020 identifier "glfwWindowShouldClose" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 18
Error (active) E0020 identifier "glfwPollEvents" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 19
Error (active) E0020 identifier "glfwDestroyWindow" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 21
Error (active) E0020 identifier "glfwTerminate" is undefined VulkanTest c:\Users\H281525\source\repos\VulkanTest\VulkanTest\main.cpp 22
Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? VulkanTest c:\users\h281525\source\repos\vulkantest\vulkantest\main.cpp 25