"I am new to programing. I am learning it by myself so its challenging. I have a problem with this code in C++, i have a global variable, but when i want to use a function, it says that it was not declared in this scope. I tried with using :: before variables but it was not working. i have 3 files, ttt.cppp ttt.hpp and ttt_funk.cpp"
//ttt.cpp
#include <iostream>
#include "ttt.hpp"
#include <vector>
std::vector<char> prvi = {' ',' ',' ',' ','|',' ',' ',' ',' ',' ','|',' ',' ',' ',' '};
std::vector<char> drugi = {' ',' ',' ',' ','|',' ',' ',' ',' ',' ','|',' ',' ',' ',' '};
std::vector<char> treci = {' ',' ',' ',' ','|',' ',' ',' ',' ',' ','|',' ',' ',' ',' '};
int main(){
std::vector<int> player1;
std::vector<int> player2;
int turn =0;
int choice;
gameDesign ();
std::cout<<"Player 1, enter your choice!\n";
std::cin>>choice;
player1.push_back(choice);
if (choice == 1){
prvi[2] = 'X';
} else if (choice == 2){
prvi[7] = 'X';
} else if (choice == 3){
prvi[12] = 'X';
}
std::cout<<"Player 2, enter your choice!\n";
std::cin>> choice;
player2.push_back(choice);
printgrid();
}
//ttt.hpp
void gameDesign ();
void printgrid();
//ttt_funk.cpp
#include <iostream>
#include <vector>
void gameDesign (){
std::cout<<"Welcome to Tic-Tac-Toe\n\n";
std::cout<<" 1 │ 2 │ 3 \n";
std::cout<<"──────────────\n";
std::cout<<" 4 │ 5 │ 6 \n";
std::cout<<"──────────────\n";
std::cout<<" 7 │ 8 │ 9\n";
};
void printgrid(){
for(int i=0; i<prvi.size(); i++){
std::cout<<prvi[i];};
std::cout<<"\n";
for(int i=0; i<drugi.size(); i++){
std::cout<<drugi[i];};
std::cout<<"\n";
for(int i=0; i<treci.size(); i++){
std::cout<<treci[i];};
std::cout<<"\n";
};