python - cryptopp 错误 : expected '=' , ',' 、 ';' 、 'asm' 或 '__attribute__' 在 '{' token 之前

标签 python gcc crypto++

我添加了一个安全模块,需要安装 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/

相关文章:

python - 查找嵌套列表的最小值、最大值和平均值?

python - Jira python 运行非常慢,有什么想法吗?

python - 如何在 pygame 中创建一个矩形并将其分配给 Sprite ?

c - 强制 C 文件中的所有数据都在 .text(或其他)部分

c++ - 带有 GunZip 的 AES/GCM,无法正确解压

python - 如何从任意深度嵌套的字典中删除

c - OpenSSL定制开发

c - 如何在我的计算机上启用对 POPCNT 指令/内部指令的支持?

c++ - 解密内存问题

c++ - 十六进制解码器输出为空