简体   繁体   English

未找到 Windows7 pthread.h

[英]Windows7 pthread.h not found

I am trying to compile libaws (http://sourceforge.net/projects/libaws/) library in Windows using cmake. I have included openssl, libxml, libcurl and I am using this command line.我正在尝试使用 cmake 在 Windows 中编译 libaws (http://sourceforge.net/projects/libaws/) 库。我已经包含了 openssl、libxml、libcurl,并且我正在使用此命令行。

C:\libaws>cmake -G "Visual Studio 10" -DCURL_LIBRARY="C:\tools\curl-7.28.1\lib" -DCURL_INCLUDE_DIR="C:\tools\curl-7.28.1\include" -DLIBXML2_LIBRARIES="C:\tools\libxml22.7.8.win32\lib" -DLIBXML2_INCLUDE_DIR="C:\tools\libxml2-2.7.8.win32\include" -DPTHREAD_INCLUDE_DIR="C:\tools\pthread\include"  ..\tools\libaws-0.9.2
--    

It throws the following error:它抛出以下错误:

-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found CURL: C:/tools/curl-7.28.1/lib (found version "7.28.1")
-- Found OpenSSL: optimized;C:/openssl/lib/ssleay32.lib;debug;C:/openssl/lib/ssleay32.lib;optimized;C:/openssl/lib/libeay32.lib;debug;C:/openssl/lib/libeay32.lib (found version "1.0.1c")
-- Found LibXml2: C:/tools/libxml2-2.7.8.win32/lib (found version "2.7.8")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found.

CMake Error at CMakeLists.txt:78 (MESSAGE): Could not find pthread development headers CMake CMakeLists.txt:78 (MESSAGE) 错误:找不到 pthread 开发标头

I have included ptherad.h, semaphore.h etc. in C:\tools\pthread\include, and provided that as a command line flag: -DPTHREAD_INCLUDE_DIR="C:\tools\pthread\include".我在 C:\tools\pthread\include 中包含了 ptherad.h、semaphore.h 等,并将其作为命令行标志提供:-DPTHREAD_INCLUDE_DIR="C:\tools\pthread\include"。 In my CMakeLists.txt, I added在我的 CMakeLists.txt 中,我添加了

INCLUDE_DIRECTORIES(${PTHREAD_INCLUDE_DIR})

Any ideas?有任何想法吗?

Visual Studio doesn't come with a "pthread" implementation. Visual Studio没有附带“ pthread”实现。 I guess you'll need to use another compiler, like MinGW. 我想您需要使用其他编译器,例如MinGW。

@jens-a-koch is right: my answer should not be accepted! @ jens-a-koch是正确的:我的答案不应该被接受! Please "unaccept" so I can remove it. 请“不接受”,这样我可以将其删除。

I belive that your CMake find module might not be using the PTHREAD_INCLUDE_DIR define (similarly to what@ drescherjm said). 我相信您的CMake查找模块可能未使用PTHREAD_INCLUDE_DIR定义(类似于what @ drescherjm所说的)。

I had the same error and the solution in short was to install Git for windows !我有同样的错误,简而言之,解决方案是为 windows 安装 Git

-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE

and in CMakeError在 CMakeError 中

checkIncludeFile.c(1,1): fatal  error C1083: Cannot open include file: 'pthread.h': No such file or directory
CheckIncludeFile.c(1,1): fatal  error C1083: #include <pthread.h>

I already have github app and I used it to clone my project, but for some reason CMake needed Git for windows , so if anyone had this issue this is what worked for me after hours of search我已经有 github 应用程序,我用它来克隆我的项目,但出于某种原因 CMake 需要Git 为 windows ,所以如果有人遇到这个问题,经过数小时的搜索,这对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM