在C++中包含头文件时,有什么区别......
1)包括.h与不包括.h在<>中包裹它时?
#include <iostream> vs. #include <iostream.h>
Run Code Online (Sandbox Code Playgroud)
2)用双引号包装标题名称而不是用<>符号包装它?
#include <iostream.h> vs. #include "iostream.h"
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我试图了解如何使用g ++和(最终)在Ubuntu上使用Clang从命令行编译C++程序.
我找到了一个解释MakeFiles的网页,我正在按照他们的指示行事.http://mrbook.org/tutorials/make/
我将这四个示例文件下载到他们自己的目录中.
然后我继续运行他们如何在没有MakeFile的情况下手动编译的示例.
g++ main.cpp hello.cpp factorial.cpp -o hello
Run Code Online (Sandbox Code Playgroud)
当我从上面运行命令时,我从g ++收到以下错误:
main.cpp:1:22: fatal error: iostream.h: No such file or directory
compilation terminated.
hello.cpp:1:22: fatal error: iostream.h: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
我编写c ++的唯一经验是使用IDE,如VS C++ Express或CodeBlocks.是不是编译器应该知道iostream.h是什么以及在哪里找到它?
如何摆脱这个错误,以便程序编译?
谢谢你的帮助.