2017-02-16 30 views
1

私はvulkanに含まれている最初のサンプルプログラムをコンパイルしようとしていますので、それをvs17 rcの新しいwin32プロジェクトに貼り付けました。サンプルディレクトリの01-init_instanceと呼ばれます。私はx86をコンパイルしています。依存関係での.libを追加する前に、私はvkCreateInstanceため、この間違ったとなっていたリンカエラーが解決されていなかったvulkan vkresultリンカエラーmsvc

enter image description here enter image description here enter image description here

(:

#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; 
} 

は、私は次のようにプロジェクトのプロパティを行っています)今私はvkResultを見つけられないため、単一の、別のリンカーエラーが発生しています。これは、私がvkcreateをどのように解決できるかわからないので、私を混乱させますが、vkresultではありません。私はすべての文字セットの設定(マルチバイト、通常のユニコードではない)を使用しましたが、それは何も変更されませんでした。

エラーがある:関数_mainで参照

エラーLNK2019未解決の外部シンボル "列挙VkResult __cdecl init_global_layer_properties(& sample_info構造体)"(init_global_layer_properties @@ YA AW4VkResult @@ AAUsample_info @@@ Z?) vktest C:\ Users \ユーザーユーザー\ドキュメントのVisual Studio 2017 \プロジェクト\ \ vktest \ vktest \ Source.obj 1

答えて

2

バルカンSDKに付属しているサンプルは、静的ライブラリにutilsフォルダをコンパイルし、とのリンクそのライブラリ。これは、init_global_layer_properties関数が存在する場所です。サンプルをそのライブラリにリンクしていない場合も、未解決のシンボルが表示されます。

+0

これを削除するにはどうすればよいですか? –

+0

あなたのコードから '#include 'とその中の何か(例えば 'init_global_layer_properties')を削除してください。 – MuertoExcobito