Makefile c++11 support

后端 未结 1 2034
予麋鹿
予麋鹿 2021-01-06 23:29

i recently started a small project in C++. I created a simply Makefile:

    CC=g++
    CFLAGS =-std=c++0x -I. -c
    VPATH = src include



    vpath %.c src         


        
相关标签:
1条回答
  • 2021-01-07 00:08

    Since you are using implicit rules for building the .o files, you should use CXXFLAGS to set the C++ flags:

    CXXFLAGS =-std=c++0x

    No need for -I. or -c.

    I would add a few more flags to get decent errors and warnings:

    CXXFLAGS := -Wall -Wextra -pedantic-errors -std+c++0x

    Likewise for g++. If your default settings do not invoke g++, then you need to add

    CXX = g++

    0 讨论(0)
提交回复
热议问题