Hey, i get the following annoying link errors when i try to build my program:

Compiling...
power level.cpp
Linking...
power level.obj : error LNK2001: unresolved external symbol "int __cdecl YesNo(void)" (?YesNo@@YAHXZ)
Debug/power level.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

The program compiles ok, but it wont build, for those who need to see the code, here is the snippet where YesNo is an integer:

int YesNo(), y, n, yes, no, h;
		cout<<"Are you a Human? Enter y or n for yes or no."<< endl;
		cin>> y, n, yes, no, YesNo();
		int check;
		scanf(" %c", &check);
			if (check=='Y'||check=='y'||check=='yes'||check=='Yes')
			{
				h = z*2;
				cout<<"Your human zenii reading is " << h << ".\a" << endl;
				cout<< ""<< endl;
				cout<<"Goodbye, " << name << "."<< endl;
				cin>> quit;
				system("cls");
				return 0;
			}
			else if (check=='N'||check=='n'||check=='no'||check=='No')
				cout<< ""<< endl;
				cout<<"Goodbye, " << name << "."<< endl;
				cin>> quit;
				system("cls");
				return 0;
	}

Recommended Answers

All 8 Replies

Where do you define the function YesNo()?

I didnt =/, i thought it was included in a library, heres the full code if you want to take a look

#include <iostream>
#include <cmath>
#include <stdio.h>

using namespace std;

int main()
{
	system("title AnimeDD RPG Calculator");
	system("color 8E");
	int value = 0;
	cout << "Enter 0 to calculate your Power Level (Battle/Training)" << endl;
	cout << "Enter 1 to calculate your Zenii (Storyline)" << endl;
	cin >> value;
{
        char name [100];
        char quit;
        quit ='\0';
        while (quit !='q')

	if(value == 0)
	{
		system("title AnimeDD Power Level Calculator");
		double creat, diff, lines, pl, x, y, z; //loads integers into memory
        cout <<"This is a simple power level calculator"<< endl;
        cout<<"What is your characters name?"<< endl;
        cin>> name; (name,100);
        cout<<"Hello, " << name << "."<<  endl;
		cout<<"Put in your current pl"<<endl;
		cin>> pl;
        cout<<"Put in your difficulty points:"<< endl; //asks for diff
        cin>> diff; //Receives difficulty and loads it into memory
        cout<<"Put in your creativity points:"<< endl;
        cin>> creat;
        cout<<"Put in your line count:"<< endl;
        cin>> lines;
        x = pl*((10*diff)+(10*creat)+(2*lines));
        y = x/(150*(log(pl/1.5)));
		z = pl+y;
        cout<<"Your Power level is " << z << ".\a" << endl;
        cout<<""<< endl;
        cout<<"Q - Quit"<< endl;
        cout<<"R - Repeat"<< endl;
        cout<<"Please type in the corresponding letter for your choice then press enter."<< endl;
        cin>> quit;
        cout<<"Goodbye, " << name << "."<< endl;
        system("PAUSE");
        system("cls");
		return 1;
        }
	else if(value == 1)
	{
		system("title AnimeDD Zenii Calculator");
		system("color 8E");
		cout <<"Alright time to calculate your Zenii, get your storyline ratings ready!" << endl;
		int lines, creat, x, o, z;
		cout<<"What is your characters name?"<< endl;
        cin>> name; (name,100);
        cout<<"Hello, " << name << "."<<  endl;
		cout<<"Put in your creativity rating for the storyline post"<< endl;
		cin>> creat;
		cout<<"Thank you, Now put in your line count for the storyline post"<< endl;
		cin>> lines;
		x = creat*creat*creat;
		o = lines*20;
		z = x+o;
		cout<<"Your zenii for this post is " << z << ".\a" << endl;
		int YesNo(), y, n, yes, no, h;
		cout<<"Are you a Human? Enter y or n for yes or no."<< endl;
		cin>> y, n, yes, no, YesNo();
		int check;
		scanf(" %c", &check);
			if (check=='Y'||check=='y'||check=='yes'||check=='Yes')
			{
				h = z*2;
				cout<<"Your human zenii reading is " << h << ".\a" << endl;
				cout<< ""<< endl;
				cout<<"Goodbye, " << name << "."<< endl;
				cin>> quit;
				system("cls");
				return 0;
			}
			else if (check=='N'||check=='n'||check=='no'||check=='No')
				cout<< ""<< endl;
				cout<<"Goodbye, " << name << "."<< endl;
				cin>> quit;
				system("cls");
				return 0;
	}
}
return 0;
}

> I didnt =/, i thought it was included in a library
Well, you'll need to define one then, or else don't use it.

int YesNo(), y, n, yes, no, h;
		cout<<"Are you a Human? Enter y or n for yes or no."<< endl;
		cin>> y, n, yes, no, YesNo();

Oy! There's a lotta weird strangeness going on there.

[edit]It looks like you tried to grab this function [post=150851]here[/post]. Poke around up that thread a bit and see how that code got working.

Lol its for an rpg, if your character is a human you get double zenii for a post

No, I meant this stuff.

int YesNo(), y, n, yes, no, h;
		cout<<"Are you a Human? Enter y or n for yes or no."<< endl;
		cin>> y, n, yes, no, YesNo();

Declaring a function prototype along with variables. Unusual.
This looks like a creature from another language with all the successive use of the comma operator.

What should i define YesNo() as then?
I just need to to put in a y, n, yes or no and have it recognise it and do it based on the check function, can you suggest anything?

Perhaps you missed my edit.

[edit]It looks like you tried to grab this function [post=150851]here[/post]. Poke around up that thread a bit and see how that code got working.

Oh sorry i missed that,
i changed the int check to char check because getint doesnt work, and removed the check for Yes and yes because they arent chars,
its now

char check;
		scanf(" %c", &check);
		getchar();
			if (check=='Y'||check=='y')

and looks like everythings running perfectly, i took out the YesNo() aswell because it overly wasnt needed, thanks alot for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.