I downloaded a sample code and cpp files include header files like list.h, queue.h, and vector.h and if I try to build then I got "fatal error: No such file or directory compilat开发者_如何学Cion terminated" I think I should include the path to the system library that has those header files but I don't know how to do that.
Thanks in advance...
Most modern "stock" C++ headers don't have a filename extension.
#include <list>
#include <queue>
#include <vector>
Old examples for old compilers. The correct file names should be <list>
, <queue>
and <vector>
accordingly. Probably some more stuff in the examples will break after you fix it, a wild guess here.
Most compilers have a -I
command-line option so you can specify additional paths to search for headers:
$ CC -I/path/to/headers foo.cpp
But the headers you mention are ".h" versions of headers that C++ already provides. You might be reading pre-standard C++, in which case you might not have those headers at all, so messing with the include path will just be a waste of time. You may need to convert that code to use the no-extension header names, like <list>
and <vector>
.
If you are using gcc then you can use,
g++ -I <include_path> file.cpp
精彩评论