Out of scope vs previosly defined errors

Questions about multiple *.cpp files and how to define the pin definitions so that it compiles.

The pin label definitions are in the main "INO" file before setup()

int PULSE=9; //PulseGen -Routines
int Xp = 2; //Indexer
int Yp = 3; //Indexer
int Ep = 4; //Indexer
int LDn = 9; //Prescaler ena
int FREQ= 8; //Prescaler in
int DD_SCLK=13; //SPI Clk
int DD_MOSI=11;
int D_C = 7; //OLED & SineGen
int CS1 =10; //OLED ??also called slave select??
int CS2 = 5; //SineGen
int AD =A0; //Volt input

void Setup ()
{
SPI.setClockDivider(SPI_CLK_DIV4);
Serial.begin(9600); //initialize Serial UART
InitTimersSafe();
bool success =SetPinFrequencySafe(9, frequency);
if (success)
{
pinMode(13, OUTPUT);
digitalWrite(13,HIGH);
}
pinMode(CS1, OUTPUT); //OLED SS or Chip Select not.
pinMode(D_C, OUTPUT); //OLED Data or Command
pinMode(DD_SCLK, OUTPUT);
pinMode(DD_MOSI, OUTPUT);
pinMode(PULSE, OUTPUT);
pinMode(CS2, OUTPUT);
pinMode(Xp, INPUT);
pinMode(Yp, INPUT);
pinMode(Ep, INPUT);
pinMode(LDn, OUTPUT);
pinMode(FREQ, INPUT);
pinMode(AD, INPUT);
digitalWrite(CS1, HIGH);
digitalWrite(CS2, HIGH);
digitalWrite(LDn, LOW);

SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV8);
}

== ONE OF THE CPP files that uses these pin parameters
=======OLED_display.cpp==========
// OLED_display.cpp
// Author : Fred Hamori
//-------------------------------------------------
#include <Arduino.h>
#include "Functions.h"
#include <SPI.h>

int CS1 =10; //OLED
int D_C = 7; //OLED & SineGen
int DD_MOSI =11;
int DD_SCLK = 13;
//int DD_SPI=13;

each one of these "redefines" is marked as an error
"previously defined here"
but if they are removed then they also create an error.
"was not declared in this scope"

One example of a function that uses these variables/pins

void OLED_cmd_wr(unsigned char command)
{
digitalWrite(D_C, LOW); // Command mode
digitalWrite(CS1, LOW); // SPI CS on
SPDR = command; // write cmd to LCD
while (!(SPSR & (1<<SPIF))); // wait til end of xfer
digitalWrite(CS1, HIGH); //terminate xfer
}
The C compilers I've used before declared pins differently and the Arduino IDE
is confusing to me since the pins were not redefined in those .cpp pages again, but were only listed once in the *.h files. That is different here since they are listed in the start of the INO file and somehow are supposed to be listed in the using .cpp file. But how?
When it comes to the high level segmentation of the Arduino program, there is little information that is clear (to me).

The C compiler I used before was KEIL for microcontrollers. I explained how that assigns pin-variables.
I have modified the INO file start where the pin-variables are defined by making them extern as in the following:
extern int PULSE=9; //PulseGen -Routines
I removed the redefinitions in the CPP file and it still gave me similar errors then I put back the definitions and its still the same. This file is still a skeleton of what it will be, but I am sending you the folder because that is probably the only way to clearly explain what is happening.

Functions.h (2.21 KB)

Initialize.cpp (1.98 KB)

OLED_display.cpp (16.9 KB)

ProbeStart.ino (2.15 KB)

Routines.cpp (1.91 KB)

main.h:

#include <Arduino.h>
extern const uint8_t D_C;

main.ino:

#include "main.h"
#include "OLED_display.h"

const uint8_t D_C = 7;

void setup() {
  pinMode(D_C, OUTPUT);
  OLED_cmd_wr(4);
}

void loop() {}

OLED_display.h:

#include <Arduino.h>
void OLED_cmd_wr(unsigned char command);

OLED_display.cpp:

#include "main.h"
#include "OLED_display.h"

void OLED_cmd_wr(unsigned char command)
{
   digitalWrite(D_C, LOW);          // Command mode 
}