fatal error LNK1120: 1 unresolved externals

So I am constructing my final for my C++ class, and I am cruising along, but then I get this weird error message that I have no idea what it means.


1>------ Build started: Project: Final Redux, Configuration: Debug Win32 ------
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\Duck\documents\visual studio 2010\Projects\Final Redux\Debug\Final Redux.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Any help would be great.

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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
  #include<iostream>
#include<string>
#include<ctime>
#include<cstdlib>
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////Variables///////////////////////////////////////////////////////
using namespace std;
int randomNumber;
int Monster();
int num;
int monsterNum;

///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////

int main(){
string input = "a";
int room = 1;

	while (input.compare("quit")!=0){

		switch (room){

			

		case 1:

cout<<"                    Terrorist Toad of the Mushroom Kingdom\n\n\n\n";		
cout << "Your name is Toad.\n";
cout<< "You were assigned a top secret mission deep in the land of the Bomb-ombs.\n\n\n";
cout<<"Your squad deserted you, left you to die. You decide to strike back\n";
cout<<"You are now... TERRORIST TOAD"<<endl;
cout<<"Type 'west', 'east', 'north', and 'south' to navigate these desolate lands"<<endl;


		

			cout << "You are at the downed helicopter\nYou can go east or west or north\n";
			getline(cin, input);

			if (input.compare("west") != 0)
				room = 2;
			else if (input.compare("east") != 0)
				room = 5;
			else if (input.compare("north") != 0)
				room = 6;
			else if (input.compare("south") != 0)
				cout << "Nope" << endl;

			break;


		case 2:

			cout << "You are in a home\n You can go west or north or east\n" << endl;
			getline(cin, input);

			if (input.compare("south") != 0)
				cout << "Nope" << endl;
			else if (input.compare("west") != 0)
				room = 3;
			else if (input.compare("east") != 0)
				cout << "Nope" << endl;
			else if (input.compare("north") != 0)
				room = 4;

			

			break;
		case 3:
			


			cout << "You are on the shore\n You can only go east\n" << endl;
			getline(cin, input);
			if (input.compare("east") != 0)
				cout << "Nope " << endl;
			else if (input.compare("south") != 0)
				room = 2;
			else if (input.compare("west") != 0)
				room = 4;
				
			else if (input.compare("north") != 0)
				cout << "Nope " << endl;


			break;
		case 4:

		


			cout << "You are in a parking lot. It kinda smells, you can go south or east\n" << endl;
			getline(cin, input);
			if (input.compare("south") != 0)
				room = 2;
			else if (input.compare("west") != 0)
				cout << "Nope" << endl;
			else if (input.compare("north") != 0)
				cout << "Nope" << endl;
			else if (input.compare("east") != 0)
				room = 6;
			break;


		case 5:
			


			
			
			
			cout << "You are in a Hospital You can go north or west\n" << endl;
			getline(cin, input);
			if (input.compare("east") != 0)
				cout<<"Nope"<<endl;
			else if (input.compare("south") != 0)
				cout << "Nope" << endl;
			else if (input.compare("west") != 0)
				room = 1; 
			else if (input.compare("north") != 0)
				room = 7;
			
			

			break;

		case 6:
			



			
			
			cout << "You are in a Hotel You can go east or west or south\n" << endl;
			getline(cin, input);
			if (input.compare("west") != 0)
				room = 4;
			else if (input.compare("south") != 0)
				room = 1;
			else if (input.compare("east") != 0)
				room = 7;
			else if (input.compare("north") != 0)
				cout << "Nope" << endl;


			

			break;

		case 7:
			

	
			

			
		cout << "You are in the Armory You can go east or north or west or south\n" << endl;
			getline(cin, input);
			if (input.compare("west") != 0)
				room = 1;
			else if (input.compare("south") != 0)
				room = 5;
			else if (input.compare("west") != 0)
				room = 6;
			else if (input.compare("north") != 0)
				room = 10;

			

			break;

		case 8:
			


			if (monsterNum == 1)
				inventory[0] = "Ruby";
			else if (monsterNum == 2)
				inventory[1] = "Emerald";
			else if (monsterNum == 3)
				inventory[2] = "Diamond";
			else if (monsterNum == 4)
				inventory[3] = "Sapphire";
			else if (monsterNum == 5)
				inventory[4] = "Gold";

			cout << "Look out! There are bad guys. You have no choice but to fight\nIn order to battle the president, you need the lucky dice\nYou can go north or west\n" << endl;
			Monster();

			getline(cin, input);
			if (input.compare("west") != 0)
				room = 7;
			else if (input.compare("south") != 0)
				cout << "Nope" << endl;
			else if (input.compare("west") != 0)
				cout << "Nope" << endl;
			else if (input.compare("north") != 0)
				room = 9;
			

			

			break;

		case 9:
			


			
			
			cout << "You are in the at the US Castle, You need to have the lucky dice! You can only go east\n" << endl;
			getline(cin, input);
			if (input.compare("west") != 0)
				room = 1;
			else if (input.compare("south") != 0)
				cout << "Nope" << endl;
			else if (input.compare("west") != 0)
				cout << "Nope" << endl;
			else if (input.compare("north") != 0)
				cout << "Nope" << endl;

			

			break;

		case 10:
			

			
			cout << "Welcome to Bass Pro! \n" << endl;
			getline(cin, input);
			if (input.compare("west") != 0)
				room = 1;
			else if (input.compare("south") != 0)
				cout << "Nope" << endl;
			else if (input.compare("west") != 0)
				cout << "Nope" << endl;
			else if (input.compare("north") != 0)
				cout << "Nope" << endl;

			break;

		}


		}

	}


int Monster(){



	

		
		srand(static_cast<unsigned> (time(0)));
		randomNumber = rand();
		num = (randomNumber % 100) + 1;


		cout << "Theres a bad guy he has a " << endl;


		if (num > 5 && num <= 10){
			cout << "Tank" <<endl;
			return 1;
		}
		else if (num > 11 && num <= 15){
			cout << "Rocket Launcher" << endl;
			return 2;
		}
		
		else if (num > 16 && num <= 30){
			cout << "Machine Gun" << endl;
			return 3;
		}
			
		else if (num > 31 && num <= 50){
			cout << "Pistol" << endl;
			return 4;
		}
		else if (num > 51 && num <= 100){
			cout << "Knife" << endl;
			return 5;
		}
}
Which kind of project did you select?
CPP file
and an Empty Project
Plss try again.

Create project->Empty project.
Then add item->.cpp file.

Copy the code and paste.

add a line string inventory[5]; any where between main and line 20.

Build and run.
Last edited on
I tried that, and nothing happened, same error.
closed account (SECMoG1T)
http://stackoverflow.com/questions/11247699/lnk2019-unresolved-external-symbol-main-referenced-in-function-tmaincrtstar
Topic archived. No new replies allowed.