compiler-errors - 编程新手,无法让Visual Studio 2013打开包含文件

我正在经历学习C++的缓慢过程,并且遇到了一个使我完全困惑的问题。

我正在尝试从www.stroustrup.com/Programming/std_lib_facilities.h保存自​​定义 header ,并获取我的.cpp文件以在目录中打开它。我已经将 header 与.cpp文件保存在同一目录中,这就是VS中的代码的样子

#include <header1.h>

int main()
{
    cout << "its bumming me out pretty bad\n";
    return 0;
}

最佳答案

首先,include应该是这样的:

#include "header1.h"

而且如果不包括iostream就不能使用cout,所以它最终应该看起来像:
#include "header1.h"
#include <iostream>
using namespace std;

int main()
{
    cout << "its bumming me out pretty bad\n";
    return 0;
}

https://stackoverflow.com/questions/27672894/

相关文章:

python - 无法运行Python脚本

c# - 错误: [feature] requires a Business (or higher)

c# - 分配的左侧必须是变量属性或索引器

c# - C#简单兴趣计算器切换错误

r - 使用 R 包 brms 时出错

c# - 具有只读哈希表的嵌套内部类在分配时引发Null ref异常。

c++ - Visual Studio中D8049错误的原因是什么?

android - Android : Take numbers, do calculations,

python - 在 Python 中不使用\n 的新行

oracle - 错误(3,31): PL/SQL: ORA-00984: Column is no