简体   繁体   English

Atom头文件C ++

[英]Atom header files c++

I am new at c++ and coding in general and I would appreciate your help! 我是C ++和编码方面的新手,感谢您的帮助! So I am using Atom and when I am trying to include a header file in my source program, it doesn't seem to recognize it. 因此,我使用的是Atom,当我尝试在源程序中包含头文件时,似乎无法识别它。 Here is a very simple program I am trying to run: 这是我尝试运行的一个非常简单的程序:

My source file: 我的源文件:

#include <iostream>
#include "file.h"
using namespace std;

int main() {
  opa();

  return 0;
}

My header file(file.h): 我的头文件(file.h):

#ifndef FILE_H_
#define FILE_H_

void opa() {
  cout << "Numerai" << endl;
}

#endif

The error I get when I compile it says: 'opa' was not declared in this scope. 我在编译时遇到的错误是:在此范围内未声明'opa'。 Any idea what is the mistake? 知道有什么错误吗?

Order of file search for meta-command 元命令的文件搜索顺序

#include "file.h"

would be 将会

  • user-defined include locations 用户定义的包含位置
  • default platform locations 默认平台位置
  • local folder (same as source file) 本地文件夹(与源文件相同)

if user didn't provide location for include files, compiler may take a platform-specific "file.h". 如果用户未提供包含文件的位置,则编译器可能会使用平台特定的“ file.h”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM