How to define C++ preprocessor variable in Makefile

前端 未结 5 1178
Happy的楠姐
Happy的楠姐 2020-12-13 17:22

I have a C++ preprocessor written like this:

  #ifdef cpp_variable
   //x+y;
  #endif

Can anyone tell me how to define this in Makefile.

5条回答
  •  萌比男神i
    2020-12-13 18:10

    Search your compiler documentation to find how to do that.

    For example for g++ the syntax is :

    g++ -Dcpp_variable 
    

    Which corresponds to adding

    CPPFLAGS += -Dcpp_variable
    

    in your makefile.

提交回复
热议问题