无法在cpp文件中包含标头

时间:2012-03-02 20:35:01

标签: c++ eclipse makefile gnu-make

我希望将其包含在我的cpp文件中:

#include <boost/lambda/lambda.hpp>

对于我的Makefile项目,我选择了属性&gt;路径和符号&gt; GNU C ++&gt;包含目录&gt; 并补充说:

/opt/local/include

但是当我尝试构建时出现此错误:

**** Build of configuration Default for project Main ****

make all 
g++ -O2 -g -Wall  -fmessage-length=0   -c -o Main.o Main.cpp
Main.cpp:107:35: error: boost/lambda/lambda.hpp: No such file or directory

问题可能是什么?

文件/opt/local/include/boost/lambda/lambda.hpp存在。

这是我的makefile:

CXXFLAGS =  -O2 -g -Wall  -fmessage-length=0

SRCS =      Main.cpp 
OBJS =      Main.o 
LIBS =      -framework CoreMIDI -framework CoreAudio -framework CoreFoundation -framework CoreServices

TARGET =    Main 

$(TARGET):  $(OBJS)
    $(CXX) -Wall -D__MACOSX_CORE__ -o $(TARGET) $(SRCS) $(LIBS)

all:    $(TARGET)

clean:
    rm -f $(OBJS) $(TARGET)

1 个答案:

答案 0 :(得分:1)

应该工作。

CXXFLAGS =  -O2 -g -Wall  -fmessage-length=0

SRCS =      Main.cpp 
OBJS =      Main.o 
LIBS =      -framework CoreMIDI -framework CoreAudio -framework CoreFoundation -    framework CoreServices
INCL_DIR = /opt/local/include
TARGET =    Main 

$(TARGET):  $(OBJS)
$(CXX) -Wall -D__MACOSX_CORE__ -o $(TARGET) $(SRCS) $(LIBS) -I $(INCL_DIR)

all:    $(TARGET)

clean:
rm -f $(OBJS) $(TARGET)
相关问题