2011-07-02 25 views
1

我一直在试图将我的pThread类移植到iOS。因此,我已将它们全部移到我的XCode项目中,并放入名为“Threading”的主要文件的子目录中。相对标题XCode 4

但是我无法编译。在pThreadThread.cpp,例如,它有一个

#include "Threading/pThreadThread.h" 

,但返回的XCode我一个错误说,它不能找到头。我假设这是因为它从目录中查看标题当前所在。因此,在前面添加“../”似乎有帮助,但它不是一个很好的解决方案,IMO。

所以我发现这个线程:

XCode 4 Relative #include paths in search?

但在尝试它似乎不工作的解决方案。首先我注意到实际的源数据在$ SRCROOT /下,所以我在(首先在User Header路径下,然后,因为在正常的头文件路径下工作不起作用),并且...它仍然没有工作。

怎么回事?我如何获得相关头文件,包括实际工作?

编辑:命令行看起来是这样的

CompileC /Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/Objects-normal/i386/pthreadThread.o VoiceAnalyser/Threading/pthreadThread.cpp normal i386 c++ com.apple.compilers.llvm.clang.1_0.compiler 
    cd "/Volumes/Dev Disk/Development/Oxford Wave Research/VoiceAnalyser" 
    setenv LANG en_US.US-ASCII 
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x c++ -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DDEBUG=1 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fvisibility-inlines-hidden -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -iquote /Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/VoiceAnalyser-generated-files.hmap -I/Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/VoiceAnalyser-own-target-headers.hmap -I/Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/VoiceAnalyser-all-target-headers.hmap -iquote /Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/VoiceAnalyser-project-headers.hmap -iquote/Volumes/Dev -iquoteDisk/Development/Oxford -iquoteWave -iquoteResearch/VoiceAnalyser -I/Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Products/Debug-iphonesimulator/include -I/Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/DerivedSources/i386 -I/Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/DerivedSources -F/Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Products/Debug-iphonesimulator -include /Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/PrecompiledHeaders/VoiceAnalyser-Prefix-dzvjbuvabxhsdtfseyyxyapbsuqv/VoiceAnalyser-Prefix.pch -c "/Volumes/Dev Disk/Development/Oxford Wave Research/VoiceAnalyser/VoiceAnalyser/Threading/pthreadThread.cpp" -o /Users/oscarforth/Library/Developer/Xcode/DerivedData/VoiceAnalyser-baxcnwbmyjmkfncxfxoaltcqbrzr/Build/Intermediates/VoiceAnalyser.build/Debug-iphonesimulator/VoiceAnalyser.build/Objects-normal/i386/pthreadThread.o 

In file included from /Volumes/Dev Disk/Development/Oxford Wave Research/VoiceAnalyser/VoiceAnalyser/Threading/pthreadThread.cpp:1: 
/Volumes/Dev Disk/Development/Oxford Wave Research/VoiceAnalyser/VoiceAnalyser/Threading/../Threading/pthreadThread.h:44:10: fatal error: 'Threading/pThreadEvent.h' file not found [2] 
#include "Threading/pThreadEvent.h" 
     ^
1 error generated. 
+0

加载我的项目是什么,你要添加页眉路径?包含pThreadThread.h的目录或包含Threading目录的目录?后者是你应该包含在标题路径中。 –

+0

@Ben Hocking:$ SRCROOT/指向我的Threading子目录所在的目录,但我仍然得到相同的构建错误。 – Goz

+0

另请注意......我已经检查并重复检查过......它绝对指向线程目录是其子目录的目录。 – Goz

回答

3

要非常小心Xcode如何用空格解释路径。就我而言,我的

-I/Volumes/Macintosh HD/Users/... 

成为

-I/Volumes/Macintosh -IHD/Users/... 

检查你的路像头搜索路径项目设置并添加双引号到您的路径。

"$(PROJECT_DIR)/YOURLIBRARY" 

代替

$(PROJECT_DIR)/YOURLIBRARY 

这个问题让我当我试图从非引导卷

0

我猜这条道路:

/卷/开发磁盘/开发/牛津 波 研究/ VoiceAnalyser/VoiceAnalyser/Threading /../ Threading/pthreadThread.h

...是无意的。你的头搜索路径应该下定决心:

/卷/开发磁盘/开发/牛津 波 研究/ VoiceAnalyser/VoiceAnalyser/

...如果你想使用“线程/ whatever.h“子路径。

+0

但是地狱是XCode从那里得到?用户标题搜索路径设置为/ Volumes/Dev Disk/Development/Oxford Wave Research/VoiceAnalyser/VoiceAnalyser/... – Goz

+0

双击该值并发布实际设置(而不是当设置为'正在编辑)。 –

+0

挂在一秒 - 它说它正在上涨并再次下降,因为它包含在pthreadThread.cpp中。包含应该是“pthreadThread.h”而不是“Threading/pthreadThread.h”,因为它位于同一个文件夹中。 –

0

您需要将目录添加到包含它的项目的“生成设置”中的页眉搜索路径中。