注:這個問題在我寫它的時候把它排序。我很難找到關於這個問題的信息,所以我覺得無論如何發佈信息都是有用的。忠告歡迎。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)...),
^
我已經搜索了一個好位,並且實際上發現了寫這句話時發生了什麼。