Skip to content

Compilation error in createWindowSurfaceUnique #22

@cone-forest

Description

@cone-forest

Hi there!
I've been using vkfw for quite a while now and recently it broke my compilation.

System Info:
Vulkan Instance Version: 1.4.321
Compiler: GCC 15.1.1

Compilation error on glfw-3.4 branch

vkfw.hpp: In function ‘vk::UniqueSurfaceKHR vkfw::createWindowSurfaceUnique(const vk::Instance&, const Window&, const VkAllocationCallbacks*)’:
vkfw.hpp:3076:9: error: ‘ObjectDestroy’ is not a member of ‘vk’; did you mean ‘vk::detail::ObjectDestroy’?
 3076 |     vk::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance, nullptr);
      |         ^~~~~~~~~~~~~
In file included from /home/michael/Development/Personal/mr-graphics/src/pch.hpp:40:
/usr/include/vulkan/vulkan.hpp:6538:11: note: ‘vk::detail::ObjectDestroy’ declared here
 6538 |     class ObjectDestroy
      |           ^~~~~~~~~~~~~
vkfw.hpp:3076:35: error: expected primary-expression before ‘,’ token
 3076 |     vk::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance, nullptr);
      |                                   ^
vkfw.hpp:3076:71: error: expected primary-expression before ‘>’ token
 3076 |     vk::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance, nullptr);
      |                                                                       ^
vkfw.hpp:3076:73: error: ‘deleter’ was not declared in this scope
 3076 |     vk::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance, nullptr);
      |                                                                         ^~~~~~~

Then switched to main branch

vkfw.hpp:3134:34: error: cannot convert ‘const VkAllocationCallbacks’ to ‘void*’ in initialization
 3134 |       vulkan_hpp_allocator = vk::AllocationCallbacks(*allocator);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then switched to 85f510d

vkfw.hpp:3132:81: error: no matching function for call to ‘vk::detail::ObjectDestroy<vk::Instance, vk::detail::DispatchLoaderStatic>::ObjectDestroy(const vk::Instance&, const vk::detail::DispatchLoaderStatic&)’
 3132 |     vk::detail::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance,
      |                                                                                 ^~~~~~~
vkfw.hpp:3132:81: note: there are 4 candidates
In file included from pch.hpp:40:
/usr/include/vulkan/vulkan.hpp:6543:7: note: candidate 1: ‘vk::detail::ObjectDestroy<OwnerType, Dispatch>::ObjectDestroy(OwnerType, vk::Optional<const vk::AllocationCallbacks>, const Dispatch&) [with OwnerType = vk::Instance; Dispatch = vk::detail::DispatchLoaderStatic]’
 6543 |       ObjectDestroy( OwnerType                                               owner,
      |       ^~~~~~~~~~~~~
/usr/include/vulkan/vulkan.hpp:6544:58: note: no known conversion for argument 2 from ‘const vk::detail::DispatchLoaderStatic’ to ‘vk::Optional<const vk::AllocationCallbacks>’
 6544 |                      Optional<const AllocationCallbacks> allocationCallbacks VULKAN_HPP_DEFAULT_ARGUMENT_NULLPTR_ASSIGNMENT,
      |                                                          ^
/usr/include/vulkan/vulkan.hpp:6541:7: note: candidate 2: ‘constexpr vk::detail::ObjectDestroy<OwnerType, Dispatch>::ObjectDestroy() [with OwnerType = vk::Instance; Dispatch = vk::detail::DispatchLoaderStatic]’
 6541 |       ObjectDestroy() = default;
      |       ^~~~~~~~~~~~~
/usr/include/vulkan/vulkan.hpp:6541:7: note: candidate expects 0 arguments, 2 provided
/usr/include/vulkan/vulkan.hpp:6538:11: note: candidate 3: ‘constexpr vk::detail::ObjectDestroy<vk::Instance, vk::detail::DispatchLoaderStatic>::ObjectDestroy(const vk::detail::ObjectDestroy<vk::Instance, vk::detail::DispatchLoaderStatic>&)’
 6538 |     class ObjectDestroy
      |           ^~~~~~~~~~~~~

Not sure what is going on here. Looks like a battle with type system. I ended up commenting deleter out

diff --git a/include/vkfw/vkfw.hpp b/include/vkfw/vkfw.hpp
index d6adf65..ab134fa 100644
--- a/include/vkfw/vkfw.hpp
+++ b/include/vkfw/vkfw.hpp
@@ -3073,8 +3073,9 @@ namespace VKFW_NAMESPACE {
     VkSurfaceKHR output;
     glfwCreateWindowSurface(instance, window, allocator, &output);
 
-    vk::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance, nullptr);
-    return vk::UniqueSurfaceKHR(output, deleter);
+    // vk::ObjectDestroy<vk::Instance, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> deleter(instance, nullptr);
+    // return vk::UniqueSurfaceKHR(output, deleter);
+    return vk::UniqueSurfaceKHR(output);
   }
     #endif
   #endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions