找不到Windows7 pthread.h

时间:2012-11-21 02:50:49

标签: c++ windows cmake pthreads

我正在尝试使用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
--    

它会抛出以下错误:

-- 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.

CMakeLists.txt上的CMake错误:78(MESSAGE):       找不到pthread开发标题

我在C:\ tools \ pthread \ include中包含了ptherad.h,semaphore.h等,并提供了作为命令行标志:-DPTHREAD_INCLUDE_DIR =“C:\ tools \ pthread \ include”。在我的CMakeLists.txt中,我添加了

INCLUDE_DIRECTORIES(${PTHREAD_INCLUDE_DIR})

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

Visual Studio没有“pthread”实现。我想你需要使用另一个编译器,比如MinGW。

@ jens-a-koch是对的:我的回答不应该被接受!请“取消接受”,以便将其删除。

我相信你的CMake find模块可能没有使用PTHREAD_INCLUDE_DIR定义(类似于@drescherjm所说的)。

相关问题