我添加了一个安全模块,需要安装 cryptopp,它是用 C 语言编写的,包含以下内容:
#include <Python.h>
#include <common/credentials.h>
#include "proto/security.pb.h"
#include <string.h>
我已经用 google 搜索了错误并验证了 Python.h header 存在,-I/usr/include/python2.6 显示在 make 中,python-devel-2.6.6-52.el6.x86_64软件包已安装。我缺少一面旗帜吗?是“命名空间”还是解析错误?
g++ -o /home/build/workarea/1.0.0/build_fileclient/baseutils/src/cc/unixusergrouphelper.os -c -g -Wall -isystem/usr/local/protobuf-2.5.0//include -O2 -pthread -fPIC -fPIC -I/home/build/workarea/1.0.0/build_fileclient -I. -I/usr/include -I/usr/local/protobuf-2.5.0/include -I/home/build/workarea/1.0.0/build_fileclient/fs -Ifs -I/home/build/workarea/1.0.0/build_fileclient/fs/common/gperftools/src -Ifs/common/gperftools/src -I/home/build/workarea/1.0.0/build_fileclient/fs/server -Ifs/server -I/home/build/workarea/1.0.0/build_fileclient/fs/client -Ifs/client -I/usr/local/java/include -I/usr/local/java/include/linux -I/usr/include/python2.6 -I/home/build/workarea/1.0.0/build_fileclient/fs/client/fileclient/java/fs-jni/target/native/javah -Ifs/client/fileclient/java/fs-jni/target/native/javah -I/home/build/workarea/1.0.0/build_version -I/home/build/workarea/github/dl/hadoop-common/hadoop-hdfs-project/hadoop-hdfs -I/home/build/workarea/github/dl/hadoop-common/hadoop-hdfs-project/hadoop-hdfs/target/native baseutils/src/cc/unixusergrouphelper.cc
In file included from /usr/include/cryptopp/osrng.h:6:0,
from fs/common/credentials.h:6,
from baseutils/src/cc/securitymodule.c:2:
/usr/include/cryptopp/config.h:97:1: error: unknown type name 'namespace'
/usr/include/cryptopp/config.h:97:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
In file included from /usr/include/cryptopp/cryptlib.h:83:0,
from /usr/include/cryptopp/randpool.h:4,
from /usr/include/cryptopp/osrng.h:10,
from fs/common/credentials.h:6,
from baseutils/src/cc/securitymodule.c:2:
/usr/include/cryptopp/stdcpp.h:14:18: fatal error: memory: No such file or directory
compilation terminated.
In file included from /usr/include/cryptopp/osrng.h:6:0,
from fs/common/credentials.h:6,
from baseutils/src/cc/securitymodule.c:2:
/usr/include/cryptopp/config.h:97:1: error: unknown type name 'namespace'
/usr/include/cryptopp/config.h:97:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
In file included from /usr/include/cryptopp/cryptlib.h:83:0,
from /usr/include/cryptopp/randpool.h:4,
from /usr/include/cryptopp/osrng.h:10,
from fs/common/credentials.h:6,
from baseutils/src/cc/securitymodule.c:2:
/usr/include/cryptopp/stdcpp.h:14:18: fatal error: memory: No such file or directory
compilation terminated.
最佳答案
GCC 根据文件名的后缀决定文件使用什么语言编写。将文件重命名为 *.cc 或 *.cpp,或者将 -x c++
传递给 g++。
关于python - cryptopp 错误 : expected '=' , ',' 、 ';' 、 'asm' 或 '__attribute__' 在 '{' token 之前,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27533953/