In linux, when you make cpp project, you might have a case that you are always forced to set default include path and default library path. This is a quick tip for you to solve this problem.


original Makefile

CC=g++

CPPFLAGS=-O2 -I/root/Project/Other/boost

LDFLAGS=-L/root/Project/Other/boost/stage/lib

LDLIBS=-lboost_regex


all: test


clean:

rm -rf test

rm -rf *.o


.bashrc

# by gilgil

export CPPFLAGS="-I/root/Project/Other/boost"

export LDFLAGS="-L/root/Project/Other/boost/stage/lib"



modified Makefile

CC=g++

CPPFLAGS+=-O2

LDLIBS=-lboost_regex


all: test


clean:

rm -rf test

rm -rf *.o


You must re-launch a terminal if a changed .bashrc file should be affectecd.