samedi 3 octobre 2015

Need help constructing my Makefile

I am implementing a list class for a project and am really confused on how to set up my makefile. I did all my coding in the Xcode IDE and it compiles perfectly there but I need to make sure I can compile my program on unix. I used c++11 features in my code and was under the impression I was writing the flag correctly in my makefile -std=c++11 but it's not being recognized. I have my List.hpp, List.h, test_list.cpp all in the same directory as my make file as well. Do I need to write something different in my makefile since my implementation of my list class is a hpp file and not a cpp file?

This is the error I am getting word for word:

g++ -std=c++11 -Wall -pedantic -g -o proj2.x test_list.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [proj2.x] Error 1

Could someone help explain where I am going wrong with my makefile? If there is anything else I should post to assist someone in answering my question do let me know.

Here is what I have:

C=g++
CXX=g++
CXXFLAGS=-std=c++11 -Wall -pedantic

proj2.x: test_list.cpp
    $(CXX) $(CXXFLAGS) -g -o proj2.x test_list.cpp

clean:
    rm *.o *.x

Aucun commentaire:

Enregistrer un commentaire