I keep getting this error while trying to make my football tournament simulator, anyone know how I can solve it? or even just what it means!

------ Build started: Project: world cup sim, Configuration: Debug Win32 ------
main.obj : error LNK2019: unresolved external symbol "void __cdecl teamstructure(void)" (?teamstructure@@YAXXZ) referenced in function _main
C:\Users\daniel\documents\visual studio 2010\Projects\world cup sim\Debug\world cup sim.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

cheers

Dan

Edited 3 Years Ago by mike_2000_17: Fixed formatting

main.obj : error LNK2019: unresolved external symbol "void __cdecl teamstructure(void)" (?teamstructure@@YAXXZ) referenced in function _main
C:\Users\daniel\documents\visual studio 2010\Projects\world cup sim\Debug\world cup sim.exe : fatal error LNK1120: 1 unresolved externals

Assuming say teamstructure.cpp is actually in the project and compiled (do a rebuild all to be sure), then the next thing to check is you've
a) spelled the function name correctly (including case sensitivity)
b) the function is void, returning void

ehhh my guess is either:

wrong name spelling for your main function
wrong data type for your main function
no return for main function

or if you're attempting for winapi, you should have winmain instead of main. Then again, post your code, there's too many guesses with what information you provided

here is the entirety of my code, hope this helps


cup header.h

#include <math.h>
#include <iostream>
#include <array>
#include <string>


using namespace std;

structure.h

void teamstructure();

main.cpp

#include "cup header.h"
#include "structure.h"


using namespace std;

void main (){

teamstructure();
return;
}

teamstucture.cpp

#include <time.h>	
#include "cup header.h"

using namespace std;

void teamstucture(){

struct team{
		string name;
		int atk;
		int def;
		int injurys;
		int kSkill;
		int sSkill;
		int lastResult;
	};


	cout<<"welcome to the world cup simulator"<<endl;
	int t = 1;
	int injury = 0;
	int kskill = 0;
	int kskillr = 0;
	int sskill = 0;
	int sskillr = 0;
	int atk = 0;
	int atkr = 0;
	int def = 0;
	int defr = 0;
	int teamnum = 0;
	string name;
	cout<<"please enter the number of teams: 2, 4 or 8"<<endl;

	team one;
	team two;
	team three;
	team four;
	team five;
	team six;
	team seven;
	team eight;

	cin>>teamnum;
	srand (time(NULL));
	while (t<= teamnum){
		cout<<"please enter the name of team "<<(t)<<endl;
		cin>>name;
		cout<<"please enter the attack score of "<<name<<" (0 - 100) "<<endl;
		cin>>atk;
		cout<<"please enter the defence score of "<<name<<" (0 - 100) "<<endl;
		cin>>def;
		cout<<"please enter the keeper skill score for "<<name<<" (0 - 100) "<<endl;
		cin>>kskill;
		cout<<"please enter the striker skill score for "<<name<<" (0 - 100) "<<endl;
		cin>>sskill;

		if (t==1){team one = {name , (atk), (def), injury, (kskill), (sskill)};	
		}else{
			if (t==2){team two = {name , (atk), (def), injury, (kskill), (sskill)};
			}else{
				if (t==3){team three = {name , (atk), (def), injury, (kskill), (sskill)};
				}else{
					if (t==4){team four = {name , (atk), (def), injury, (kskill), (sskill)};
					}else{
						if (t==5){team five = {name , (atk), (def), injury, (kskill), (sskill)};
						}else{
							if (t==6){team six = {name , (atk), (def), injury, (kskill), (sskill)};
							}else{
								if (t==7){team seven = {name , (atk), (def), injury, (kskill), (sskill)};
								}else{
									if (t==8){team eight = {name , (atk), (def), injury, (kskill), (sskill)};

									}
								}
							}
						}
					}
				}
			}
		}t++;
	}

	cout<< one.name<<" atk "<<one.atk<<" def "<<one.def<<" injury "<<one.injurys<<" keeper "<<one.kSkill<<" striker "<<one.sSkill<<endl;
	cout<< two.name<<" atk "<<two.atk<<" def "<<two.def<<" injury "<<two.injurys<<" keeper "<<two.kSkill<<" striker "<<two.sSkill<<endl;
	cout<< three.name<<" atk "<<three.atk<<" def "<<three.def<<" injury "<<three.injurys<<" keeper "<<three.kSkill<<" striker "<<three.sSkill<<endl;
	cout<< four.name<<" atk "<<four.atk<<" def "<<four.def<<" injury "<<four.injurys<<" keeper "<<four.kSkill<<" striker "<<four.sSkill<<endl;
	cout<< five.name<<" atk "<<five.atk<<" def "<<five.def<<" injury "<<five.injurys<<" keeper "<<five.kSkill<<" striker "<<five.sSkill<<endl;
	cout<< six.name<<" atk "<<six.atk<<" def "<<six.def<<" injury "<<six.injurys<<" keeper "<<six.kSkill<<" striker "<<six.sSkill<<endl;
	cout<< seven.name<<" atk "<<seven.atk<<" def "<<seven.def<<" injury "<<seven.injurys<<" keeper "<<seven.kSkill<<" striker "<<seven.sSkill<<endl;
	cout<< eight.name<<" atk "<<eight.atk<<" def "<<eight.def<<" injury "<<eight.injurys<<" keeper "<<eight.kSkill<<" striker "<<eight.sSkill<<endl;

}

I knot the code for the structure is a bit messy and not the most elegant solution but i intend to tidy it up once i actually get it working.

Cheers
Dan

This question has already been answered. Start a new discussion instead.