Search code examples
c++11gccmakefileautomake

gcc 4.8.2 cc1plus: error: unrecognized command line option "-std=gnu++11"


I have a system in which I've been compiling programs with C++11 using automake and everything has been working.

However, when a different user take the same exact Makefile they get the aforementioned error.

Now, if they type in g++ --std=gnu++11 program.cpp then there are no complaints.

I've narrowed it down to a line that is causing the issue; however, I don't know how to fix it.

depbase=`echo no_endl.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        g++ -DHAVE_CONFIG_H -I. -I../..    -g --std=gnu++11 -g -O2 -MT no_endl.o -MD -MP -MF $depbase.Tpo -c -o no_endl.o no_endl.cpp &&\
        mv -f $depbase.Tpo $depbase.Po

The problem is with depbase; however, I don't know what is going on with it or why it is there.

Below is the Automake file that I used to generate the Makefile:

bin_PROGRAMS = no_endl
AM_CXXFLAGS = -g --std=gnu++11
no_endl_SOURCES = no_endl.cpp

The only difference between my g++ and their g++ is I have an alias so g++ turns into g++ -g.

Helpful information

g++ --version                                                          
g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If there is any other information that I need to provide, then let me know.

Related Question


Solution

  • I solved the problem.

    The problem was the $PATH variables for me and other users.

    Now, other users have an alias for g++ to the newer version, but their $PATH omits the actual location.

    Make works based on their $PATH variable, so to fix it, I just had to make sure their path had the same location as mine.