Build error __forceinline__ and __cdecl refined using thrust - 有什么问题吗?

问题描述 投票:0回答:0

在 Windows 上使用 Cmake 在 Clion 中构建以下代码时出现错误。我不知道我做错了什么。有人知道吗?

#include <thrust/host_vector.h>
#include <thrust/device_vector.h>

#include <iostream>

int main()
{
    // H has storage for 4 integers
    thrust::host_vector<int> H(4);

    // initialize individual elements
    H[0] = 14;
    H[1] = 20;
    H[2] = 38;
    H[3] = 46;

    // H.size() returns the size of vector H
    std::cout << "H has size " << H.size() << std::endl;

    // print contents of H
    for(int i = 0; i < H.size(); i++)
        std::cout << "H[" << i << "] = " << H[i] << std::endl;

    // resize H
    H.resize(2);

    std::cout << "H now has size " << H.size() << std::endl;

    // Copy host_vector H to device_vector D
    thrust::device_vector<int> D = H;

    // elements of D can be modified
    D[0] = 99;
    D[1] = 88;

    // print contents of D
    for(int i = 0; i < D.size(); i++)
        std::cout << "D[" << i << "] = " << D[i] << std::endl;

    // H and D are automatically deleted when the function returns
    return 0;
}

以上代码只是取自 Thrust 网站的示例代码。 CMakeLists.txt 是:

cmake_minimum_required(VERSION 3.19)
project(Code)

set(CMAKE_CXX_STANDARD 14)

add_executable(Code main.cpp)

find_package(Thrust)
thrust_create_target(Thrust)
target_link_libraries(Code Thrust)

错误是: https://pastebin.com/JXtMSUyU 遗憾的是,它不允许我发布直接错误,因为它说我需要添加更多详细信息。可悲的是我没有更多细节,因为我不知道哪里出了问题。

编辑:我使用的系统是 8700k 和 GTX 1080。因此它支持 CUDA。

c++ cmake cuda thrust build-error
© www.soinside.com 2019 - 2024. All rights reserved.