&引用;未定义对“对齐的”alloc'的引用&引用;构建GLFW测试时出错';vulkan';和克莱恩

&引用;未定义对“对齐的”alloc'的引用&引用;构建GLFW测试时出错';vulkan';和克莱恩,c,opengl,cmake,glfw,clion,C,Opengl,Cmake,Glfw,Clion,我想从CLion中的源代码构建GLFW。它成功地构建了GLFW库,但始终无法构建目标“vulkan”,错误日志如下 "E:\ide\CLion 2017.2.1\bin\cmake\bin\cmake.exe" --build E:\tool\glfw-3.2.1 --target vulkan -- -j 2 [ 92%] Built target glfw Scanning dependencies of target vulkan [ 92%] Building C object test

我想从CLion中的源代码构建GLFW。它成功地构建了GLFW库,但始终无法构建目标“vulkan”,错误日志如下

"E:\ide\CLion 2017.2.1\bin\cmake\bin\cmake.exe" --build E:\tool\glfw-3.2.1 --target vulkan -- -j 2
[ 92%] Built target glfw
Scanning dependencies of target vulkan
[ 92%] Building C object tests/CMakeFiles/vulkan.dir/vulkan.c.obj
E:\tool\glfw-3.2.1\tests\vulkan.c: In function 'myalloc':
E:\tool\glfw-3.2.1\tests\vulkan.c:1671:5: warning: implicit declaration of function 'aligned_alloc' [-Wimplicit-function-declaration]
     return aligned_alloc(alignment, size);
     ^
E:\tool\glfw-3.2.1\tests\vulkan.c:1671:5: warning: return makes pointer from integer without a cast
[100%] Linking C executable vulkan.exe
Warning: resolving _vkEndCommandBuffer@4 by linking to _vkEndCommandBuffer
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
Warning: resolving _vkQueueSubmit@20 by linking to _vkQueueSubmit
Warning: resolving _vkQueueWaitIdle@4 by linking to _vkQueueWaitIdle
Warning: resolving _vkFreeCommandBuffers@20 by linking to _vkFreeCommandBuffers
Warning: resolving _vkAllocateCommandBuffers@12 by linking to _vkAllocateCommandBuffers
Warning: resolving _vkBeginCommandBuffer@8 by linking to _vkBeginCommandBuffer
Warning: resolving _vkCmdPipelineBarrier@40 by linking to _vkCmdPipelineBarrier
Warning: resolving _vkCmdBeginRenderPass@12 by linking to _vkCmdBeginRenderPass
Warning: resolving _vkCmdBindPipeline@16 by linking to _vkCmdBindPipeline
Warning: resolving _vkCmdBindDescriptorSets@36 by linking to _vkCmdBindDescriptorSets
Warning: resolving _vkCmdSetViewport@16 by linking to _vkCmdSetViewport
Warning: resolving _vkCmdSetScissor@16 by linking to _vkCmdSetScissor
Warning: resolving _vkCmdBindVertexBuffers@20 by linking to _vkCmdBindVertexBuffers
Warning: resolving _vkCmdDraw@20 by linking to _vkCmdDraw
Warning: resolving _vkCmdEndRenderPass@4 by linking to _vkCmdEndRenderPass
Warning: resolving _vkCreateSemaphore@16 by linking to _vkCreateSemaphore
Warning: resolving _vkDestroySemaphore@16 by linking to _vkDestroySemaphore
Warning: resolving _vkCreateImageView@16 by linking to _vkCreateImageView
Warning: resolving _vkCreateImage@16 by linking to _vkCreateImage
Warning: resolving _vkGetImageMemoryRequirements@16 by linking to _vkGetImageMemoryRequirements
Warning: resolving _vkAllocateMemory@16 by linking to _vkAllocateMemory
Warning: resolving _vkBindImageMemory@28 by linking to _vkBindImageMemory
Warning: resolving _vkGetImageSubresourceLayout@20 by linking to _vkGetImageSubresourceLayout
Warning: resolving _vkMapMemory@36 by linking to _vkMapMemory
Warning: resolving _vkUnmapMemory@12 by linking to _vkUnmapMemory
Warning: resolving _vkDestroyImage@16 by linking to _vkDestroyImage
Warning: resolving _vkFreeMemory@16 by linking to _vkFreeMemory
Warning: resolving _vkGetPhysicalDeviceFormatProperties@12 by linking to _vkGetPhysicalDeviceFormatProperties
Warning: resolving _vkCmdCopyImage@36 by linking to _vkCmdCopyImage
Warning: resolving _vkCreateSampler@16 by linking to _vkCreateSampler
Warning: resolving _vkCreateBuffer@16 by linking to _vkCreateBuffer
Warning: resolving _vkGetBufferMemoryRequirements@16 by linking to _vkGetBufferMemoryRequirements
Warning: resolving _vkBindBufferMemory@28 by linking to _vkBindBufferMemory
Warning: resolving _vkCreateDescriptorSetLayout@16 by linking to _vkCreateDescriptorSetLayout
Warning: resolving _vkCreatePipelineLayout@16 by linking to _vkCreatePipelineLayout
Warning: resolving _vkCreateRenderPass@16 by linking to _vkCreateRenderPass
Warning: resolving _vkCreateShaderModule@16 by linking to _vkCreateShaderModule
Warning: resolving _vkCreatePipelineCache@16 by linking to _vkCreatePipelineCache
Warning: resolving _vkCreateGraphicsPipelines@28 by linking to _vkCreateGraphicsPipelines
Warning: resolving _vkDestroyPipelineCache@16 by linking to _vkDestroyPipelineCache
Warning: resolving _vkDestroyShaderModule@16 by linking to _vkDestroyShaderModule
Warning: resolving _vkCreateDescriptorPool@16 by linking to _vkCreateDescriptorPool
Warning: resolving _vkAllocateDescriptorSets@12 by linking to _vkAllocateDescriptorSets
Warning: resolving _vkUpdateDescriptorSets@20 by linking to _vkUpdateDescriptorSets
Warning: resolving _vkCreateFramebuffer@16 by linking to _vkCreateFramebuffer
Warning: resolving _vkCreateCommandPool@16 by linking to _vkCreateCommandPool
Warning: resolving _vkDeviceWaitIdle@4 by linking to _vkDeviceWaitIdle
Warning: resolving _vkEnumerateInstanceLayerProperties@8 by linking to _vkEnumerateInstanceLayerProperties
Warning: resolving _vkEnumerateInstanceExtensionProperties@12 by linking to _vkEnumerateInstanceExtensionProperties
Warning: resolving _vkCreateInstance@12 by linking to _vkCreateInstance
Warning: resolving _vkEnumeratePhysicalDevices@12 by linking to _vkEnumeratePhysicalDevices
Warning: resolving _vkEnumerateDeviceLayerProperties@12 by linking to _vkEnumerateDeviceLayerProperties
Warning: resolving _vkEnumerateDeviceExtensionProperties@16 by linking to _vkEnumerateDeviceExtensionProperties
Warning: resolving _vkGetInstanceProcAddr@8 by linking to _vkGetInstanceProcAddr
Warning: resolving _vkGetPhysicalDeviceProperties@8 by linking to _vkGetPhysicalDeviceProperties
Warning: resolving _vkGetPhysicalDeviceQueueFamilyProperties@12 by linking to _vkGetPhysicalDeviceQueueFamilyProperties
Warning: resolving _vkCreateDevice@16 by linking to _vkCreateDevice
Warning: resolving _vkGetDeviceProcAddr@8 by linking to _vkGetDeviceProcAddr
Warning: resolving _vkGetDeviceQueue@16 by linking to _vkGetDeviceQueue
Warning: resolving _vkGetPhysicalDeviceMemoryProperties@8 by linking to _vkGetPhysicalDeviceMemoryProperties
Warning: resolving _vkDestroyFramebuffer@16 by linking to _vkDestroyFramebuffer
Warning: resolving _vkDestroyDescriptorPool@16 by linking to _vkDestroyDescriptorPool
Warning: resolving _vkDestroyCommandPool@16 by linking to _vkDestroyCommandPool
Warning: resolving _vkDestroyPipeline@16 by linking to _vkDestroyPipeline
Warning: resolving _vkDestroyRenderPass@16 by linking to _vkDestroyRenderPass
Warning: resolving _vkDestroyPipelineLayout@16 by linking to _vkDestroyPipelineLayout
Warning: resolving _vkDestroyDescriptorSetLayout@16 by linking to _vkDestroyDescriptorSetLayout
Warning: resolving _vkDestroyBuffer@16 by linking to _vkDestroyBuffer
Warning: resolving _vkDestroyImageView@16 by linking to _vkDestroyImageView
Warning: resolving _vkDestroySampler@16 by linking to _vkDestroySampler
Warning: resolving _vkDestroyDevice@8 by linking to _vkDestroyDevice
Warning: resolving _vkDestroySurfaceKHR@16 by linking to _vkDestroySurfaceKHR
Warning: resolving _vkDestroyInstance@8 by linking to _vkDestroyInstance
CMakeFiles\vulkan.dir/objects.a(vulkan.c.obj):vulkan.c:(.text+0x37a3): undefined reference to `aligned_alloc'
collect2.exe: error: ld returned 1 exit status
tests\CMakeFiles\vulkan.dir\build.make:98: recipe for target 'tests/vulkan.exe' failed
mingw32-make.exe[3]: *** [tests/vulkan.exe] Error 1
CMakeFiles\Makefile2:1162: recipe for target 'tests/CMakeFiles/vulkan.dir/all' failed
mingw32-make.exe[2]: *** [tests/CMakeFiles/vulkan.dir/all] Error 2
CMakeFiles\Makefile2:1174: recipe for target 'tests/CMakeFiles/vulkan.dir/rule' failed
mingw32-make.exe[1]: *** [tests/CMakeFiles/vulkan.dir/rule] Error 2
Makefile:514: recipe for target 'vulkan' failed
mingw32-make.exe: *** [vulkan] Error 2
起初,我认为它没有在建筑中使用C11,但在我将
set(CMAKE\u C\u标准11)
添加到CMakeLists.txt后,它也不起作用


Env:GLFW-3.2.1、CLion 2017.2.2、CMake 3.8.2和MinGW 3.20。

aligned_alloc应在您使用的标准库中。你能在那里找到它吗?“隐藏在任何有趣的“也许是吧?”安德烈亚斯很抱歉在回来之前拖了这么长时间。我使用的是官方源代码,似乎它们都正确导入了。
\ifndef\u MSC\u VER\define\u ISOC11\u source/*用于aligned\u alloc()*/#endif#include#include#include#include
这是vulcan.cOk的头儿。我问的是stdlib.h的内容,而不是vulkan.c/h。查看我自己的VS env,我找不到对齐的alloc声明。你看过了吗:是的,我的
stdlib.h
在MinGW中没有
aligned\u alloc
。但是它已经有了
#define\u ISOC11\u SOURCE
。这是否意味着我无法在MinGW中构建“vulkan”测试?似乎如此:-(您可以尝试在之前声明它#包括vulkan.h,然后自己实现它:aligned#u alloc应该在您使用的stdlib.h中。可以在那里找到它吗?隐藏在任何有趣的#ifdef?后面?@Andreas抱歉在返回之前拖了这么长时间。我使用的是官方源代码,它们似乎都导入正确。)ly.
#ifndef#MSC#VER#定义(ISOC11)源代码/*用于对齐的(alloc)*/#endif#include#include#include#include#include
它是vulcan.cOk的头目很好。我问的是stdlib.h的内容,而不是vulkan.c/h。看看我自己的VS env我找不到对齐的alloc声明。你看了吗:是的,我的
stdlib.h
在MinGW中没有对齐的alloc。但它一直都是eady有
#define#ISOC11_SOURCE
。这是否意味着我无法在MinGW中构建“vulkan”测试?似乎是这样:-(您可以尝试在之前声明它#包括vulkan.h,然后自己实现它: