kgr*_*ffs 5 c c++ windows 64-bit pthreads
看起来已经做了一些工作来使pthread-win32与 x64 一起工作,但没有构建说明。我尝试使用 Visual Studio x64 交叉工具命令提示符进行简单构建,但是当我尝试从 x64 应用程序链接到库时,它看不到任何函数导出。看起来它仍在将 lib 编译为 x86 或其他东西。
我什至尝试将 /MACHINE 添加到 makefile 的适当位置,但没有帮助。有人让它发挥作用吗?
小智 6
您可以在此处使用vcpkg 。这是 C++ 的 Windows 包管理器。它支持 pthread 构建以及其他开源库。
我想使用静态 pthread 库。当我下载pthread时,我得到了dll(pthread.dll)并导入lib(pthread.lib),即我不能只使用pthread.lib,我必须使用pthread.dll文件。
因此,我使用 vcpkg 构建了静态库。我可以在没有任何 dll 依赖的情况下使用它
使用“vcpkg”您可以构建静态和动态库
您可以使用以下步骤
下面我添加了所有 DLL (x86|x64) 和 LIB (x86|x64) 情况的步骤。您可以根据您的需要构建它。
从 git 目录克隆 vcpkg vcpkg git repo
从克隆 vcpkg 的目录中运行以下命令 - 这将安装 vcpkg
bootstrap - vcpkg.bat
Run Code Online (Sandbox Code Playgroud)
通过运行以下命令检查库的可用性
vcpkg search pthread
Run Code Online (Sandbox Code Playgroud)
这将向您显示以下结果
mbedtls[pthreads] Multi-threading support
pthread 3.0.0 empty package, linking to other port
pthreads 3.0.0-6 pthreads for windows
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,它支持 Windows 的 pthread
1.使用导入库(DLL)构建动态库
构建 x86 DLL
vcpkg install pthreads:x86-windows
Run Code Online (Sandbox Code Playgroud)
这将在.\vcpkg\installed\x86-windows中构建 dll 和导入库,从这里复制lib并包含,您可以使用它们
构建 x64 DLL
vcpkg install pthreads:x64-windows
Run Code Online (Sandbox Code Playgroud)
这将在.\vcpkg\installed\x64-windows中构建 dll 和导入库,从这里复制lib和include文件夹。
2. 构建静态库(LIB)
构建 x86 LIB
vcpkg install pthreads:x86-windows-static
Run Code Online (Sandbox Code Playgroud)
这将在.\vcpkg\installed\x86-windows-static中构建 dll 和导入库, 从这里复制lib并包含,您可以使用它们
构建 x64 LIB
vcpkg install pthreads:x64-windows-static
Run Code Online (Sandbox Code Playgroud)
这将在.\vcpkg\installed\x64-windows-static中构建 dll 和导入库, 从此处复制lib和include文件夹。
注意: 尝试以管理员权限使用
在正式发布之前,看起来您必须查看 CVS 头才能获取该库的 2.9 版本。2.9 版本包含所有 x64 补丁,但如果尝试从命令行编译静态库,仍然会遇到问题。
我知道的唯一解决方法是使用 DLL,而不是静态链接 LIB。
| 归档时间: |
|
| 查看次数: |
15770 次 |
| 最近记录: |