I have this three files header.h
extern int global_var;
header.cpp
#include "header.h"
int global_var=50;
main.cpp
#include<iostream>
#include "header.h"
using namespace std;
global_var+=100;
int main(){
cout<<global_var;
}
when I run the prog error occurred : global_var does not name a type
I know when I put global var inside main function work but I want to know why this problem occurred