注:这个问题在我写它的时候把它排序。我很难找到关于这个问题的信息,所以我觉得无论如何发布信息都是有用的。忠告欢迎。GCC -I打破标准库编译
大家好。我最近在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
。
请注意,后者包括不满意,所以编译器正确地抱怨。现在,我希望我所有的#include
都是相对于项目的根,而不是它们的文件。好的,我编辑我的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)...),
^
我已经搜索了一个好位,并且实际上发现了写这句话时发生了什么。