[Linker Error] Undefined reference to..

Hello Guys! I just want to ask about this error that i've been encountering on my program. Can someone help me to eliminate this error? Thanks in Advance.
PS: This was actually a program intended for Airplane Seat Reservation.

-------------------------------------------------------------------------------


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define s scanf
#define p printf


int Options();
int SeatArr();
int PChoice();      
int option;
int row;
char column;
int opt;
char gotcha;

//------------------------------ Main Function!!--------------------------------
int main()
{
  
      p ("\n\n\t\t  WELCOME to AIRPLANE SEAT RESERVATION");
      Options();
      
getch();
return 0;

}

//------------------------------ Options!!--------------------------------------


int Options ()
{
p ("\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n\n");
p ("Enter your Choice:\n\n"); 
p (" [1] Display the Seat Arrangement\t [3] Exit the Program\n [2] Input the Passenger's Choice");
p ("\n\nCHOICE: ");
s ("%d", &option);
switch(option)
      { 
        case 1:
        SeatArr();
        break;
        
        case 2:
        PChoice();
        break;
        
        case 3:
        system ("Pause");
        
        default:
        p ("Invalid!");
        break;
      }
p ("\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n\n");
return (option);
}


//------------------------------ Seating Arrangement!!--------------------------


int SeatArr()               
{

    int a,b;
    char Arr[5][4]= {{1,1,1,1},{2,2,2,2},{3,3,3,3},{4,4,4,4},{5,5,5,5}};
    char Ans;
p ("\n  _________________________________________________________________________\n");
p ("    SEATING ARRANGEMENT\n\n");
  gotcha='X';
   for (a=0; a<5; a++)
   {
       for (b=0; b<4; b++)
       {
           if (b=0);
           {
           if (a==row)
              {
                      if (b==column)
                      {
                         p("%s", gotcha);
                      }
                      else 
                      {
                        p("        %dA\t", Arr[a][b]);
           if (a!=row)
           {
                continue;          
               }
           if (b=1);
           {
               if (b==column)
                      {
                         p("%s", gotcha);
                      }
                      else 
                      {
                        p("        %dB\t", Arr[a][b]);
                      }
           }
           if (b=2);
           {               
               if (b==column)
                      {
                         p("%s", gotcha);
                      }
                      else 
                      {
                        p("        %dC\t", Arr[a][b]);
                      }
           }
           if (b=3);
           {
               if (b==column)
                      {
                         p("%s", gotcha);
                      }
                      else 
                      {
                        p("        %dD\t", Arr[a][b]);
                      }
           }
       }
       p ("\n");
   }
   
   p ("\n  Proceed with the Reservation/Assigning? [Y/N]: ");
   s ("%s", &Ans);
   
   if (toupper(Ans)=='Y')
   {
   PChoice();
   }
   else
   {
   Options();
   }
}
}
//------------------------------ Passenger's Choice!!---------------------------


PChoice();
{
p ("\n  _________________________________________________________________________\n");
p ("    PASSENGER's CHOICE\n\n");
    p ("    Enter your desired Seat Number: ");
    s ("%d%c", &row, &column);
column=toupper(column);

switch (column)
{
     case 'A':
     column=0;
     break;
     
     case 'B':
     column=1;
     break;
     
     case 'C':
     column=2;
     break;
     
     case 'D':
     column=3;
     break;
     
}
Options();
return (row,column);
}
}}



-------------------------------------------------------------------------------
Sorry for its lengthiness also ^_^
Last edited on
Use code tags
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
PChoice();
{
p ("\n _________________________________________________________________________\n");
p (" PASSENGER's CHOICE\n\n");
p (" Enter your desired Seat Number: ");
s ("%d%c", &row, &column);
column=toupper(column);

switch (column)
{
case 'A':
column=0;
break;

case 'B':
column=1;
break;

case 'C':
column=2;
break;

case 'D':
column=3;
break;

}
Options();
return (row,column);
}
}}


Remove the semicon at then end of line 1.
Undefined reference to..

To what? If you don't tell the exact error, then why could we help?


PS. Please use code tags and sensible indentation when posting code.
To remove the said warning. Honestly, i don't know where the exact error is.
@shadowCODE
it does still have error even i delete the semicolon at the end of line 1
I cannot help much if I don't knoe the exact error.
Undefined reference to what??
to 'PChoice()'
@Ishan23

If you have warnings or errors, then post them here in full, so we can have some idea of what is happening.

In addition to your existing problem, you have some of these:

if (b=0);

= is for assignment, == for equality comparison. Also remove the semicolon, at the moment it means the code does nothing. Should look like this :

1
2
3
if (b == 0) {
   // your code here
}
After removing the semicolon on line 1, u should add a return type.
Line 79,94,105,116: Remove the ; It terminates the if statement.

You have mismatched {} in both SeatArr and PChoice. PChoice is undefined because of the mismatched {}.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button.
Last edited on
@AsbstractionAnon
Thanks! Its a big help! Godbless!
Topic archived. No new replies allowed.