我一直在試圖將我的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.
加載我的項目是什麼,你要添加頁眉路徑?包含pThreadThread.h的目錄或包含Threading目錄的目錄?後者是你應該包含在標題路徑中。 –
@Ben Hocking:$ SRCROOT/指向我的Threading子目錄所在的目錄,但我仍然得到相同的構建錯誤。 –
Goz
另請注意......我已經檢查並重複檢查過......它絕對指向線程目錄是其子目錄的目錄。 – Goz