OpenCV - 找不到'cstdint'文件
OpenCV - 'cstdint' file not found
我使用的是Mac 10.10和OpenCV 3.0,当我在编译我的项目时,我得到了这个错误:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
之后,我将c++标准库更改为libstdc++,出现了另一个错误:
/usr/local/include/opencv2/hal/defs.h:271:14: 'cstdint'文件未找到
希望有人能帮助我
根据这个问题的顶部答案,有两种方法可以解决这个问题,关于这个事实,你正在使用macOs和你的默认编译器是Clang。你可以使用:
#include <tr1/cstdint>
或
#include <stdint.h>
而不是cstdint,这是libc++的一部分。
我在尝试将为c++编写的头文件(.h)导入某些Objective C代码(.m)时遇到了这个问题。
我的解决方案是创建一个中间的Objective c++文件(.mm)和头文件,导入c++头文件,然后导出C兼容的包装函数。
头文件中有类似这样的内容,以使其与Objective-C (.m)代码兼容
#if defined(__cplusplus)
extern "C" {
#endif
const char *MyNewFunction(void); // or whatever
#if defined(__cplusplus)
}
#endif
(感谢Dave Hylands帮我弄明白了这一切)
相关文章:
- .cpp和.h文件中的模板专用化声明
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 文本文件中的单词链表
- CMake-按正确顺序将项目与C运行时对象文件链接
- 使用新行和不使用新行读取文件
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 挂起和取消挂起一个文件DLL
- 如何确定我已使用非编码文件到达 EOF?
- 命名空间中具有.h和.cpp文件的类
- 如何使用ndk-build.cmd构建Android.so文件
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 读取文件并输入到矢量中
- 在C++中查找文件
- c++库的公共头文件中应该包含什么
- 用c++从输入文件中读取另一行
- Cppcheck生成xml转储文件
- 读取文件的最后一行并输入到链接列表时出错
- 无法编译 rtmidi 测试 cmidiin.cpp 文件, 非法指令
- 如何将内容数组写入文本文件?
- OpenCV - 找不到'cstdint'文件