Makefile modification to support c++11

前端 未结 3 1338
后悔当初
后悔当初 2021-01-12 13:41

I am able to compile a single file using gcc with -std=c++0x option. But I can\'t do this through makefile. Here are the set of flags in my makefile (which after make compla

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 14:27

    This way your makefile will use all of your CFLAGS:

    CFLAGS=-O3 -std=c++0x -pg -D_DEBUG -g -c -Wall
    

    You're overriding them with each "CFLAGS=..." declaration.

    Moreover, it should be CXXFLAGS, not CFLAGS. CFLAGS is for C applications.

    As @Florian Sowade said, you could use CFLAGS += -O3 -std.... (or CXXFLAGS..), so that users can provide their own flags when executing make.

提交回复
热议问题