I'm getting an error message that says:
[Linker error] undefined reference to 'WELCOME MESSAGE'
[Linker error] undefined reference to 'MENU'
[Linker error] undefined reference to 'drop_inches'
.....the error applies for every function call
...help please
CODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define mcoef 7000
#define gravity 9.81
#define powder_constant 4000
#define SIZE 100
#define drag_coef 0.5190793992194678
typedef struct wind_drift{
double wind_speed;
double time;
int angle_of_wind;
double muzzle_velocity;
double range_in_yards;
double drift;
}case1[SIZE];
typedef struct drop_inches{
double time;
double drop_in;
}case2[SIZE];
typedef struct recoil_impulse{
double bullet_mass_grains;
double muzzle_velocity;
int velocity_coef;
double charge_mass;
double m_coef;
double r_impulse;
}case3[SIZE];
typedef struct recoil_velocity{
double r_impulse;
int gun_mass;
double r_velocity;
}case4 [SIZE];
typedef struct recoil_energy{
double r_energy;
double gun_mass;
double r_velocity;
}case5 [SIZE];
typedef struct muzzle_energy{
double bullet_mass_grains;
double muzzle_velocity;
double m_energy;
double m_energy_joules;
//7,000 grains = 1 pound
// ME = [(weight of bullet in pounds)*(muzzle velocity^2)]/64
//Mult. the above equations' answer by 1.348 to get the answer in Joules
}case6 [SIZE];
typedef struct ball_coef{
double bullet_mass_grains;
double bullet_diameter_inches;
double b_coef;
double s_d;
}case7 [SIZE];
typedef struct momentum{
double muzzle_velocity;
double bullet_mass_grains;
double bullet_mass;
}case8 [SIZE];
void WELCOME_MESSAGE(void);
void MENU(void);
int main(void)
{
//declare-intialize variables
int choice =0;
int pick =0;
int enterance =0;
char quit =' ';
char rifle_or_pistol =' ';
char charts[100];
char rifle_round =' ';
char pistol_round =' ';
int date =0;
int time =0;
FILE *fp1;
FILE *fp2;
FILE *fp3;
FILE *fp4;
FILE *fp5;
FILE *fp6;
FILE *fp7;
FILE *fp8;
//welcome prompt
WELCOME_MESSAGE();
//Initialize the quit option
quit ='n';
do{
MENU();
//Ask the user for the date
printf("Please enter the date (MMDDYYYY)");
scanf("%d\n", &date);
//Ask the user for the time
printf("Please enter the time (HHMMSS)");
scanf("%d\n\n", &time);
//Ask the user if he/she wishes to continue
printf("Enter the corresponding number for the funtion you wish"
" to perform\n");
fflush(stdin);
scanf("%d", &choice);
system("cls");
switch(choice)
{
case 1: //Perform a calculation
printf("Choose a ballistics calculation to perform\n\n"
"1: Projectile drop (in inches)\n"
"2: Wind Drift of Projectile in Flight\n"
"3: Recoil Impulse\n"
"4: Recoil Velocity\n"
"5: Recoil Energy\n"
"6: Muzzle Energy\n"
"7: Ballistic Coefficient\n"
"8: Momentum of the Projectile\n"
"9: Quit\n\n");
// Read/collect the user's input
fflush(stdin);
scanf("%d", &pick);
do{
switch(pick)
{
case 1:
//calculate projectile drop (in inches)
fp1 = fopen("drop_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
drop_inches();
break;
case 2:
//calculate wind drift
fp1 = fopen("wind_drift_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
wind_drift();
break;
case 3:
//calculate recoil impulse
fp1 = fopen("recoil_impulse_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
recoil_impulse();
break;
case 4:
//calculate recoil velocity
fp1 = fopen("recoil_velocity_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
recoil_velocity();
break;
case 5:
//calculate recoil energy
fp1 = fopen("recoil_energy_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
recoil_energy();
break;
case 6:
//calculate muzzle energy
fp1 = fopen("muzzle_energy_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
muzzle_energy();
break;
case 7:
//calculate ballistic coefficient
fp1 = fopen("ballistic_coef_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
ball_coef();
break;
case 8:
//calculate momentum
fp1 = fopen("momentum_calc.txt", "a");
fprintf(fp1, "%d %d", date, time);
fclose(fp1);
momentum();
break;
case 9:
//quit
break;
}
}while(pick == 1||2||3||4||5||6||7||8||9);
case 2: //Display a ballistics chart
do{
printf("\n\nWould you like to see a ballistic chart for a "
"rifle round or a pistol round? (Type 'r' for rifle, or 'p'"
" for pistol)\n\n");
fflush(stdin);
scanf("%c", &rifle_or_pistol);
switch(rifle_or_pistol)
{
case 'r':
strcpy(charts, "rifle_");
printf("For which rifle round would you like to see"
" a ballistics chart?\n\n1: 6.8 SPC\n2: .308\n"
"3: .30-06\n4: .223\n5: 5.56 or 7.62\n6: 7.62"
"\n7: .30-30\n8: .50 BMG\n");
fflush(stdin);
scanf("%d", &rifle_round);
{
switch(rifle_round)
{
case 1:
strcat(charts, "68.doc");
break;
case 2:
strcat(charts, "308.doc");
break;
case 3:
strcat(charts, "3006.doc");
break;
case 4:
strcat(charts, "223.doc");
break;
case 5:
strcat(charts, "556.doc");
break;
case 6:
strcat(charts, "762.doc");
break;
case 7:
strcat(charts, "3030.doc");
break;
case 8:
strcat(charts, "50.doc");
break;
default:
printf("Invalid input. Try again.");
}
}
case 'p':
strcpy(charts, "pistol_");
printf("%s", charts);
printf("For which pistol round would you like to see"
" a ballistics chart?\n\n1: .45 ACP\n2: .357 SIG\n"
"3: .500 Mag\n4: .38 Spcl\n5: .44 Mag\n6: .40"
"\n7: 9mm (Luger and Parabellum)\n\n");
fflush(stdin);
scanf("%d", &rifle_round);
{
switch(rifle_round)
{
case 1:
strcat(charts, "45ACP.doc");
break;
case 2:
strcat(charts, "357SIG.doc");
break;
case 3:
strcat(charts, "500MAG.doc");
break;
case 4:
strcat(charts, "38SPCL.doc");
break;
case 5:
strcat(charts, "44MAG.doc");
break;
case 6:
strcat(charts, "40.doc");
break;
case 7:
strcat(charts, "9MM.doc");
break;
default:
printf("Invalid input. Try again.");
}
}
}while(choice!='r' || choice!='p');
}while(quit == 'n');
//open file to the screen
system(charts);
break;
case 3: //Quit
printf("Goodbye\n");
quit='y';
break;
default:
//error message
printf("Your input is invalid. Please try again.\n");
//closes switch
}while(choice ==1||2||3);
}while(quit == 'n');
//pause then quit
system("pause");
return(0);
}
Here are my functions in my .h file
CODE
//*********************PROTOTYPES
void WELCOME_MESSAGE(void);
void MENU(void);
void drop_inches(int date, int time);
void wind_drift(int date, int time);
void recoil_impulse(int date, int time);
void recoil_velocity(int date, int time);
void recoil_energy(int date, int time);
void muzzle_energy(int date, int time);
void ball_coef(int date, int time);
void momentum(int date, int time);
//*********************FUNCTIONS DEFINITIONS
//Welcome screen
void WELCOME_MESSAGE(void)
{
printf(" \n\n\n Welcome to the Ballistics Calculator! \n\n\n"
" +-'~`-------------------------------- / | -- \n"
"||"""""""""""""""""""""""""""""""""" \\\\\\ | |~) \n"
"|| \\\\\\ | |_ \n"
" |~~~~~~~~-_______________-_________________| ~--_ \n"
" !---------|________ ------~~~~~(-- )--~~ \n"
" \ /~~~~\~~\ )--- |_ |( \n"
" || | | \ () || \n"
" \\____|_ | ()| || \n"
" `~~~~~~~~~-.|| || \n"
" || <($)> || \n"
" || || \n"
" || || \n"
" || || \n"
" || || \n"
" || || \n"
" || || \n"
" || () || \n"
" _|_|__====~~~ \n\n\n");
system("pause");
system("cls");
}
//Menu screen
void MENU(void)
{
system("cls");
printf("\n\n Choose the operation that you would like to perform \n\n"
" /-\______________ \n"
" | | ~ ~ ~ ~ ~ ~ => \n"
" \----------------- \n"
" / /) / \n"
" / /---- \n"
" / / \n"
" /____/ \n\n\n\n"
"Ballistics Menu: \n"
"1: Perform a calculation\n"
"2: See a ballistics chart for a certain round\n"
"3: Quit\n\n");
}
//This function computes wind drift
void wind_drift(void) //need to bring date and time from main
{
char choice1 =' ';
FILE *fp1;
fp1 = fopen("wind_drift_calc.txt", "a");
do{
printf("Enter the wind speed in miles per hour: \n");
fflush(stdin);
scanf("%lf\n\n", &case1.windspeed);
printf("Enter the bullet's time of flight in seconds: \n");
fflush(stdin);
scanf("%lf\n\n", &case1.time);
printf("Enter the angle of the wind off the bullet's trajectory"
" path: \n");
fflush(stdin);
scanf("%d\n\n", &case1.angle_of_wind);
printf("Enter the muzzle velocity: \n");
fflush(stdin);
scanf("%lf\n\n", &case1.muzzle_velocity);
printf("Enter the range in yards: \n");
fflush(stdin);
scanf("%lf\n\n", &case1.range_in_yards);
drift = [(sin(angle_of_wind))*wind_speed]*[time-(muzzle_
velocity/range_in_yards)]
prin