简体   繁体   中英

Atom header files c++

I am new at c++ and coding in general and I would appreciate your help! 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. 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):

#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. 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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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