致命错误:google/protobuf/port_def.inc:没有这样的文件或目录 #include < google/protobuf/port_def.inc>
fatal error: google/protobuf/port_def.inc: No such file or directory #include <google/protobuf/port_def.inc>
我有Windows。我想使用库TensorFlow创建C OP。在此站点https://www.tensorflow.org/guide/extend/op#compile_the_op_uside_your_your_system_compiler_compiler_tensorflow_binary_installation我知道我应该做:
TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )
g++ -std=c++11 -shared zero_out.cc -o zero_out.so -fPIC ${TF_CFLAGS[@]} ${TF_LFLAGS[@]} -O2
我做到了。但是我得到了下一个问题:
In file included from C:PythonPython37libsite-packagestensorflowinclude/tensorflow/core/framework/op_def_builder.h:24,
from C:PythonPython37libsite-packagestensorflowinclude/tensorflow/core/framework/op.h:23,
from zero_out.cc:4:
C:PythonPython37libsite-packagestensorflowinclude/tensorflow/core/framework/op_def.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory
#include google/protobuf/port_def.inc
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
我不明白如何解决这个问题。如果您能帮助我解决此问题
我认为您现在可能已经解决了问题,但要引用其他提出一个可能的解决方案的引用。查找TensorFlow包含目录路径,并在编译代码时包含它。您可以手动检查标题文件(案例中缺少(是否存在于包含路径中。
tf_include_dir=($(python -c "import tensorflow as tf; print(tf.sysconfig.get_include())"))
并修改您的编译命令以包括tf_include_dir,即
g++ -std=c++11 -Itf_include_dir -shared zero_out.cc -o zero_out.so -fPIC ${TF_CFLAGS[@]} ${TF_LFLAGS[@]} -O2
我使用一种简单的方法,每当make
失败时:
make clean
make all -j 16
相关文章:
- 在具有全局类型def的类中使用成员函数指针
- 这是 basic.def.odr 部分的缺陷吗?
- 在使用 Clang 编译 DLL 时指定 DEF 文件
- 函数模板签名中忽略的成员类型def 的访问说明符
- 删除unicode def后,无法将QString转换为TCHAR
- C++ 如何在 def 文件中指定命名空间
- 如何在 LLVM 后端的机器级别找到 def-use 链
- 如何迭代映射 inc++ 的向量
- Paths.get( "abc/def.jpg" ) 在 C 和 C++ 中获取与操作系统无关的路径的等价物是什么?
- md5 inC++ with UTF16LE
- INC 操作码编译到错误的地址
- 无法键入 def std::chrono::microseconds 以覆盖其定义以更改其基础类型
- 致命错误:google/protobuf/port_def.inc:没有这样的文件或目录 #include < google/protobuf/port_def.inc>
- 使用 .def 文件的优缺点
- C++ & C 中的".inc"文件有什么意义?您想在什么情况下使用它?
- 根据 [basic.def.odr]/2,'A::a[0]' 的潜在结果集为空.为什么它是空的?
- TensorFlow从C 中的Graph Def获得形状
- 访问使用 def 文件导出的静态变量时崩溃
- 使用 DEF 文件删除 dll 导出的名称
- 挂钩在Linux上通过.def文件上的功能