2

I installed gcc 4.6.3 Please help me to solve this problem. First I configured the GMP and next configured NTL, but while building HElib I am getting this error. when I type the make command it showing error as:

cc1plus: error: unrecognized command line option -std=c++11
3
  • 1
    What version of Ubuntu are you running? How did you install GCC and exactly what steps did you follow to build HElib? Are you working from directions that are available online, and if so can you provide a link? Are you specifically trying to use gcc 4.6.3? Would a later version be sufficient? Is that the version provided by the Ubuntu release that you are using? Please edit your question to add information. Jan 13, 2017 at 12:31
  • What version does g++ -version report?
    – jhilmer
    Jan 13, 2017 at 12:58
  • i am using Ubuntu 12 version , i followed the steps given in this link to build HElib:: github.com/shaih/HElib Jan 16, 2017 at 5:07

1 Answer 1

4

GCC 4.6.x pre-dates support for the C++11 standard so does not provide -std=c++11. It anticpates C++11 experimentally and provides -std=c++0x to enable that experimental support. -std=c++11 is first available in GCC 4.7.x. If you cannot upgrade to a more recent compiler then change -std=c++11 to -std=c++0x.

Contd. for OP's comments

Perhaps you have not read the INSTALL.TXT file of the HELib package? Specfically:

Before building HElib, you may want to look at the Makefile, and consider adjusting some of the defaults for CC and CFLAGS. The defaults should be OK on most systems, but you can see the suggested options, which are documented in the Makefile.

Following this advice, edit src/Makefile, find:

CFLAGS = -g -O2 -std=c++11 -pthread -DFHE_THREADS -DFHE_DCRT_THREADS -DFHE_BOOT_THREADS

and change -std=c++11 to -std=c++0x.

Be aware that the project is not guaranteed to build successfully with gcc 4.6.3 - a very old compiler version - after this change; but without making this change gcc 4.6.3 cannot be used with any degree of C++11 support at all.

You have not given any reason for using such an old compiler.

2
  • Respected Sir, Can you please say me the steps how to change -std=c++11 to -std=c++0x. I am not getting how to change it. Jan 16, 2017 at 5:11
  • @PrabhulingBiradar you can use the gnu text editor for editing Makefile with CFLAGS definition en.wikipedia.org/wiki/Emacs Oct 22, 2020 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.