The header:
#ifndef DECLARATIONS_H_
#define DECLARATIONS_H_
#endif /*DECLARATIONS_H_*/
#include <iostream>
#include <cctype>
using namespace std;
extern int pointer;
Main cpp:
#include "Declarations.h"
int main() {
string input = "something something";
int pointer = input.length();
}
And then when I use it in another .cpp that includes the header at the very top and uses "pointer", it gives an undefined reference pointer.
I don't think it is a linking problem either because when I use functions from the C libraries that I included in the header file in the cpp files it works.