[lammps-users] g++: error: unrecognized command line option ‘-restrict’; did you mean ‘-Wrestrict’?

Hi All,

This question was stated previously ( 03/16/2019) by another user and the answer was to submit the problem through,

I still get the same error “g++: error: unrecognized command line option ‘-restrict’; did you mean ‘-Wrestrict’?” while building LAMMPS with “make omp”. I have tried multiple g++ compilers (7-10) also updated my “openmpi” to 4.1.1. My Linux is Cenos-7. Unfortunately non of these worked for me and I would appreciate someone’s help with this.

The option “-restrict” is recognized by the Intel compilers, not the GCC compilers (they don’t need it).
So you have to edit the corresponding makefile (best to first copy it to src/MAKE/MINE and then edit it there, so that you retain the original)

Also, if you are unfamiliar with editing makefiles, figuring out which flags are supported by which compilers and how to tune them, or generally adapting settings manually, you make want consider compiling LAMMPS via the CMake route where many system/compiler specific settings are auto-detected by the CMake program. https://docs.lammps.org/Build_cmake.html