【发布时间】:2012-03-02 20:35:00
【问题描述】:
我希望将其包含在我的 cpp 文件中:
#include <boost/lambda/lambda.hpp>
对于我的 Makefile 项目,我选择了 Properties>Path and Symbols>GNU C++>Include Directories> 并补充说:
/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 存在。
这是我的生成文件:
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)
【问题讨论】:
-
/opt/local/include 在您的库路径中吗?我不知道它是否默认在 Linux 上。
-
调用行似乎缺少
-I /opt/local/include。可能是某处设置了环境变量,但这不太可能。再次检查您的配置设置。 -
我已将 CXXFLGAS += -I/opt/local/include 添加到生成文件中,但仍然没有运气。我做错了什么?
-
@KerrekSB 更好:
-isystem。这可以防止一堆不相关的警告,并允许您使用-Werror集进行编译。 -
注意拼写错误:
CXXFLGAS应该是CXXFLAGS
标签: c++ eclipse makefile gnu-make