ios - “strcmp”未在此范围内声明

标签 ios g++ makefile toolchain gnu-toolchain

我正在使用这个 tutorial 构建 ios 工具链.当我运行命令 make ENABLE_OPTIMIZED=1 时,我得到了这个输出。

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

我不确定这是怎么回事,我的谷歌搜索也没有太大帮助。

最佳答案

strcmp 函数声明在string.h 中尝试放入

#include <string.h> 

在 DynamicLibrary.cpp 中,stderr 在 stdio.h 中被定义,所以也把它放在一起

#include <stdio.h>

我有时会发现缺少头文件的开源代码。

更新:

如果你有不同的名字,你可以搜索include目录,

在真正的 GNU/Linux bash 中(应该也适用于 Windows 10 WSL)你可以使用它来搜索函数:

find /usr/include -type f | xargs grep ' strcmp\s*\('

这是变量:

find /usr/include -type f | xargs grep '[\s*]stdin\s*;'

在 Windows 上的 Git Bash 上有/include 和 /mingw64/include 目录,但在我的安装中只有 ImageMagick 头文件和 /mingw64/include/gnumake.h

关于ios - “strcmp”未在此范围内声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9403975/

相关文章:

variables - g++变量名称有长度限制吗?

c - Makefile 中 undefined reference `le16toh' 错误

C - 函数具有内部链接但未定义

ios - 将array1和array 2的值合并到array3 objective-c 中

ios - viewforoverlay 永远不会被调用

linux - 如何为 aCC (Hp-Ux) 和 g++ (Linux) 获得相同的预处理器输出?

c++ - Make在Boost中找不到.hpp文件

ios - AVAudioPlayer 预加载的声音从内存中泄漏

ios - 共享扩展注册类型标识符

c++ - 自动为 Qt 配置套件