Your question doesn't make any sense. It's impossible for any function to run before main. main is called automatically when the program starts. One of the first thing your main does is call showFight, so that's when showFight executes. If you want it to run later, then call it later.
tpb: When I build and run it does execute before my main function. It's not supposed to do that until the user selects "1" at the main menu in my main function.
When I build and run it does execute before my main function
NO IT DOESN'T. Did you hear that?
MAIN ALWAYS RUNS FIRST!!!!!!!!!!!!!!!!!!!!!!
IN YOUR MAIN YOU ARE CALLING showFight. THAT'S WHY IT RUNS!!!!!!!!!!!!!!!!!!!!!!!!!
IF YOU WANT IT TO RUN AT A LATER POINT, THEN CALL IT AT A LATER POINT!!!!!!!!!!!!!!!!
I don't understand your question because main() is the starting point for every program.
You call showfight() on line 113, perhaps this call is in the wrong location.
Also you appear to have several warnings that you should strive to fix.
main.cpp||In member function ‘int Player::getValues()’:|
main.cpp|34|warning: no return statement in function returning non-void [-Wreturn-type]|
main.cpp||In member function ‘int Player::lvlUp()’:|
main.cpp|41|warning: no return statement in function returning non-void [-Wreturn-type]|
main.cpp||In function ‘int healPlayer(int, Player&, Items&)’:|
main.cpp|102|warning: no return statement in function returning non-void [-Wreturn-type]|
main.cpp||In function ‘int showFight(int, Player&)’:|
main.cpp|232|warning: control reaches end of non-void function [-Wreturn-type]|
main.cpp|180|warning: ‘badguyATK’ is used uninitialized in this function [-Wuninitialized]|
Also you appear to have several warnings that you should strive to fix.
If you are using GCC/MinGW or Clang I strongly recommend that you at least use the -Wall compiler flag. It gives you a lot of useful warning messages when making simple mistakes like this.
If you don't want to call the function on line 113, then don't.
Note that you store the return value of line 113 call in variable fightWin.
You don't store the return value of line 129 call at all.
On line 130 you do use the value of variable fightWin.
Note that your showFight returns an int. However, all exit paths of the function do not return a value and the paths that do, do return a bool value. Why the function does not return a bool?