2012-02-22 408 views
11

我正在構建使用此tutorial的ios工具鏈。當我運行命令make ENABLE_OPTIMIZED = 1時,我得到這個輸出。'strcmp'未在此範圍內聲明

llvm[0]: Reconfiguring with /home/connor/llvm-svn/configure 
config.status: creating Makefile.config 
config.status: creating llvm.spec 
config.status: creating docs/doxygen.cfg 
config.status: creating tools/llvm-config/llvm-config.in 
config.status: creating include/llvm/Config/config.h 
config.status: creating include/llvm/Support/DataTypes.h 
config.status: include/llvm/Support/DataTypes.h is unchanged 
config.status: creating include/llvm/ADT/hash_map 
config.status: include/llvm/ADT/hash_map is unchanged 
config.status: creating include/llvm/ADT/hash_set 
config.status: include/llvm/ADT/hash_set is unchanged 
config.status: creating include/llvm/ADT/iterator 
config.status: include/llvm/ADT/iterator is unchanged 
config.status: executing setup commands 
config.status: executing Makefile commands 
config.status: executing Makefile.common commands 
config.status: executing examples/Makefile commands 
config.status: executing lib/Makefile commands 
config.status: executing runtime/Makefile commands 
config.status: executing test/Makefile commands 
config.status: executing test/Makefile.tests commands 
config.status: executing tools/Makefile commands 
config.status: executing utils/Makefile commands 
config.status: executing projects/Makefile commands 
config.status: executing bindings/Makefile commands 
config.status: executing bindings/ocaml/Makefile.ocaml commands 
make[1]: Entering directory `/home/connor/llvm-svn/lib/System' 
llvm[1]: Compiling Alarm.cpp for Release build 
llvm[1]: Compiling Disassembler.cpp for Release build 
Disassembler.cpp: In function ‘std::string llvm::sys::disassembleBuffer(uint8_t*, size_t, uint64_t)’: 
Disassembler.cpp:44:12: warning: variable ‘bits’ set but not used [-Wunused-but-set-variable] 
llvm[1]: Compiling DynamicLibrary.cpp for Release build 
DynamicLibrary.cpp: In static member function ‘static void* llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(const char*)’: 
DynamicLibrary.cpp:178:5: error: ‘strcmp’ was not declared in this scope 
DynamicLibrary.cpp:178:5: error: ‘stderr’ was not declared in this scope 
DynamicLibrary.cpp:179:5: error: ‘strcmp’ was not declared in this scope 
DynamicLibrary.cpp:179:5: error: ‘stdout’ was not declared in this scope 
DynamicLibrary.cpp:180:5: error: ‘strcmp’ was not declared in this scope 
DynamicLibrary.cpp:180:5: error: ‘stdin’ was not declared in this scope 
make[1]: *** [/home/connor/llvm-svn/lib/System/Release/DynamicLibrary.o] Error 1 
make[1]: Leaving directory `/home/connor/llvm-svn/lib/System' 
make: *** [all] Error 1 

我不知道該怎麼做,我的谷歌搜索沒有太大的幫助。

+1

在'string.h'中聲明'strcmp'試圖在'DynamicLibrary.cpp'中放入'#include ',並且在'stdio.h'中標記stderr,所以也是這樣。 – jcubic 2012-02-22 22:19:54

+0

@jcubic將您的評論發佈爲答案。 – 0xDE4E15B 2012-02-22 22:29:14

+0

不明白這一個。也許嘗試再次運行'./configure'。 – jcubic 2012-02-22 22:43:24

回答

18

的strcmp功能string.h中聲明試圖把

#include <string.h> 
在DynamicLibrary.cpp

和標準錯誤是在stdio.h defained所以就把太

#include <stdio.h> 

不時我找到缺少頭文件的開源代碼。

+0

謝謝你,它修復了幾乎所有的東西。現在,當我編譯我只是有這個錯誤: llvm [0]:使用/ home/connor/llvm-svn/configure重新配置 make:*** [/home/connor/llvm-svn/config.status]錯誤1 – connor 2012-02-22 22:39:20

+0

您可以嘗試爲此創建另一個問題。 – jcubic 2012-02-22 22:44:25