【发布时间】:2014-09-24 08:04:58
【问题描述】:
注意:这个问题是在我写它的时候自行解决的。我很难找到关于这个问题的信息,所以我觉得无论如何发布它会很有用。欢迎咨询。
大家好。我最近在我的 Linux Mint 上安装了 GCC 4.9.1,一直在编译我的一些项目,一切都很顺利。
现在我想重新开始一个这样的项目,从一些源文件排序开始。所以我创建了一个新文件夹并在其中移动了几个 .h 和 .tpp 文件。结构如下:
.
├── clip
│ ├── Clip.h
│ ├── ClipImpl.tpp
│ └── Mask.h
:
├── main.cpp
:
├── vect.cpp
├── vect.h
:
main.cpp 只是#include "clip/Clip.h",稍后将包含一些用于测试目的的模板实例化。 clip/Clip.h包含clip/Mask.h,需要vect.h。
请注意,后者包含不满足,因此编译器正确地抱怨。现在,我希望我的所有#includes 都相对于项目的根目录,而不是它们所来自的文件。好的,我编辑我的 Makefile :
# Retrieve the root directory
WD = $(shell pwd)
...
# Add it to the include search paths
%.o: %.cpp # vvvvvvv
$(CXX) $(CXXFLAGS) -I$(WD) -c $<
然后……砰??
g++ -std=c++1y `sdl2-config --cflags` -Wall -Wextra -Winline -fno-rtti -I/home/quentin/NetBeansProjects/glk -c AutoDisplayed.cpp
In file included from /home/quentin/NetBeansProjects/glk/time.h:4:0,
from /usr/include/sched.h:33,
from /usr/include/pthread.h:23,
from /opt/gcc-4.9.1/include/c++/4.9.1/x86_64-unknown-linux-gnu/bits/gthr-default.h:35,
from /opt/gcc-4.9.1/include/c++/4.9.1/x86_64-unknown-linux-gnu/bits/gthr.h:148,
from /opt/gcc-4.9.1/include/c++/4.9.1/ext/atomicity.h:35,
from /opt/gcc-4.9.1/include/c++/4.9.1/bits/basic_string.h:39,
from /opt/gcc-4.9.1/include/c++/4.9.1/string:52,
from /opt/gcc-4.9.1/include/c++/4.9.1/stdexcept:39,
from /opt/gcc-4.9.1/include/c++/4.9.1/array:38,
from /opt/gcc-4.9.1/include/c++/4.9.1/tuple:39,
from /opt/gcc-4.9.1/include/c++/4.9.1/bits/stl_map.h:63,
from /opt/gcc-4.9.1/include/c++/4.9.1/map:61,
from AutoDisplayed.h:5,
from AutoDisplayed.cpp:1:
/opt/gcc-4.9.1/include/c++/4.9.1/functional: In member function ‘_Result std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...)’:
/opt/gcc-4.9.1/include/c++/4.9.1/functional:1322:8: error: ‘forward_as_tuple’ is not a member of ‘std’
std::forward_as_tuple(std::forward<_Args>(__args)...),
^
我已经搜索了很多,实际上在写这句话时发现了发生了什么。
【问题讨论】:
标签: c++ include include-path gcc4.9