Edit:
I have 2 functions in one header file. If I cut and paste these functions into the main file, it works perfectly without any errors. That being said, as of right now, the current code gives me the following errors posted below in the errors section
Thank you for any help!!!
Test1314.cpp
/*
#include<string>
#include<map>
#include<iostream>
*/
#include"myFunctions.h"
using namespace std;
//some unrelated code
int main(){
while (run){
size= sizeof(vars)/sizeof(*vars);
cout<<"\nentering function\n\n";
customIn(vars, size); // calling my function that at this time is supposed to just pair the "variables" to their respective type
cout<<"\nexiting function\n\n";
cout<<varToName["a"]; //this was to test to see if i could use my function
checkclose(1);
}
}
myFunctions.h
#ifndef myFunctions
#define myFunctions
#include<iostream>
#include<string>
#include<map>
bool run=true;
char check,confirm,ss2=253;
bool checkclose(int s){
//code to ask the user if they want to run the program again. Returns 'run', a boolean
}
static map <string, int> varToInt;
static map <string, float> varToFloat;
static map <string, string> varToString;
static map <string, char> varToChar;
static map <string, string> varToName ;
int integers421[256];
float decimals246[256];
string strings2365[256];
char characters2762[256];
int varType[256][2];
void customIn(string vars[][3], int size){
for(int i=0; i<size; i++){
cout<<"\nsize: "<<size<<"\nIndex: "<<i<<"\n";
varToName.insert(pair<string,string>(vars[i][1],vars[i][0]));
if(vars[i][2].compare("int")==0){
varToInt.insert(pair<string,int>(vars[i][1],integers421[i]));
cout<<"mapped "<<vars[i][0]<<" "<<vars[i][1]<<" "<<vars[i][2]<<" to "<<i<<" in the Integers Array";
}
else if(vars[i][2].compare("float")==0){
varToFloat.insert(pair<string,float>(vars[i][1],decimals246[i]));
cout<<"mapped "<<vars[i][0]<<" "<<vars[i][1]<<" "<<vars[i][2]<<" to "<<i<<" in the Floats Array";
}
else if(vars[i][2].compare("string")==0){
varToString.insert(pair<string,string>(vars[i][1],strings2365[i]));
cout<<"mapped "<<vars[i][0]<<" "<<vars[i][1]<<" "<<vars[i][2]<<" to "<<i<<" in the Strings Array";
}
else if(vars[i][2].compare("char")==0){
varToChar.insert(pair<string,char>(vars[i][1],characters2762[i]));
cout<<"mapped "<<vars[i][0]<<" "<<vars[i][1]<<" "<<vars[i][2]<<" to "<<i<<" in the Characters Array";
}
}
}
#endif
The errors that I am getting with this current code
C:\Users\######\test1314.cpp In function 'int main()':
45 22 'customIn' was not declared in this scope
50 9 'varToName' was not declared in this scope