user2464424 user2464424 - 3 months ago 15
C Question

setting up vulkan for code::blocks via glfw or lunarg

I have code::blocks and a spare evening, would like to put my hands on vulkan. Now on windows 7.

I'm having troubles finding any documentation/tutorials nor the libraries to work in codeblocks. I have glfw 3.2 but it requires a vulkan library and headers as well to work with it (

#define GLFW_INCLUDE_VULKAN
) otherwise it rightfully complains about a missing
vulkan/vulkan.h
. Also installed LunarG, but can't find any recognizable libraries in the package that i could link via the linker settings in the usual way.

My code right now is straightforward:

...
#include <GL/glu.h>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>

int main(int argc, char **argv) {
glfwInit();
return glfwVulkanSupported();
}


with
-lglu32 -lglfw3 -lopengl32 -lgdi32


Basically all i think i need is a library to link to but can't find any on the web.

Answer
  1. Using the old GLU library may not be a good idea with Vulkan

  2. Instal the LunarG SDK.

  3. Set additional include directory in your IDE project: $VULKAN_SDK/Include (VULKAN_SDK is an env variable with a path to root of the SDK).

  4. Do not link against OpenGL if you are only going to use Vulkan.

  5. Code::Blocks is g++ or clang based right? Link against the vulkan-1.dll. -lvulkan-1 should suffice, because the path should be in PATH. Otherwise provide the path with -L — it is in $WINDIR/System32 (for x64 and x32 OS) and in $WINDIR/SysWOW64 (for x32 app on x64 OS).

vulkan-1.dll is installed there by drivers and by the SDK also.

Comments