【发布时间】:2017-02-16 01:54:56
【问题描述】:
我正在尝试编译 vulkan 中包含的第一个示例程序,因此我将其粘贴到 vs17 rc 中的新 win32 项目中。它在 Samples 目录中称为 01-init_instance。我正在编译 x86。
#include <iostream>
#include <cstdlib>
#include <util_init.hpp>
#define APP_SHORT_NAME "vulkansamples_instance"
int main(int argc, char *argv[]) {
struct sample_info info = {};
init_global_layer_properties(info);
/* VULKAN_KEY_START */
// initialize the VkApplicationInfo structure
VkApplicationInfo app_info = {};
app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
app_info.pNext = NULL;
app_info.pApplicationName = APP_SHORT_NAME;
app_info.applicationVersion = 1;
app_info.pEngineName = APP_SHORT_NAME;
app_info.engineVersion = 1;
app_info.apiVersion = VK_API_VERSION_1_0;
// initialize the VkInstanceCreateInfo structure
VkInstanceCreateInfo inst_info = {};
inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
inst_info.pNext = NULL;
inst_info.flags = 0;
inst_info.pApplicationInfo = &app_info;
inst_info.enabledExtensionCount = 0;
inst_info.ppEnabledExtensionNames = NULL;
inst_info.enabledLayerCount = 0;
inst_info.ppEnabledLayerNames = NULL;
VkInstance inst;
VkResult res;
res = vkCreateInstance(&inst_info, NULL, &inst);
if (res == VK_ERROR_INCOMPATIBLE_DRIVER) {
std::cout << "cannot find a compatible Vulkan ICD\n";
exit(-1);
}
else if (res) {
std::cout << "unknown error\n";
exit(-1);
}
vkDestroyInstance(inst, NULL);
/* VULKAN_KEY_END */
return 0;
}
我已经完成了项目属性,例如:
我犯了这个错误,并且由于未解决 vkCreateInstance 的链接器错误(在将 .lib 添加到依赖项中之前),现在我因为找不到 vkResult 而收到一个不同的链接器错误。这让我很困惑,因为我不知道它如何解决 vkcreate 而不是 vkresult。我使用了所有的字符集设置(多字节,而不是正常的 unicode),但这并没有改变任何东西。
错误是:
在函数 _main vktest C:\Users\user\Documents\Visual工作室 2017\Projects\vktest\vktest\Source.obj 1
【问题讨论】:
标签: c++ visual-studio linker vulkan