user2569618
user2569618

Reputation: 687

cryptopp error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token

I've added a security module, which requires cryptopp to be installed, is written in C and contains the following includes:

#include <Python.h>
#include <common/credentials.h>
#include "proto/security.pb.h"
#include <string.h>

I've googled the error and have verified that the Python.h header exists, the -I/usr/include/python2.6 shows up in the make, python-devel-2.6.6-52.el6.x86_64 package is installed. Am I missing a flag? Is it the "namespace" or is it a parsing error?

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.

Upvotes: 2

Views: 1015

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798636

GCC decides what language a file is written in based on the filename's suffix. Either rename the file to *.cc or *.cpp, or pass -x c++ to g++.

Upvotes: 2

Related Questions