无法使用 库 生成DLL

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

我有一个正在处理的DLL项目,并且尝试使用标头生成随机数。

我的工具: Visual Studio 2019 C ++ MSVC

[每当我尝试构建以下经过稍微修改的代码Example code from Microsoft docs

#include <iostream>
#include <random>

int getRandNum()
{
    std::random_device rd;   // non-deterministic generator
    std::mt19937 gen(rd());  // to seed mersenne twister.
                             // replace the call to rd() with a
                             // constant value to get repeatable
                             // results.
    return gen();
}

我收到这些错误:

enter image description here

经过不成功的研究,我决定快速创建一个新的DLL项目,并在其中使用相同的功能,出现相同的问题。然后,我创建了一个控制台项目,并使用标题测试了该功能,并且一切正常。

我不确定我缺少什么,也许是配置问题?

c++ visual-studio dll
1个回答
0
投票

您确定Visual Studio可以看到文件随机标头吗?如果右键单击“随机”,是否可以打开实际的随机头文件?

© www.soinside.com 2019 - 2024. All rights reserved.