| | |
Annoying link errors
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Hey, i get the following annoying link errors when i try to build my program:
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:
•
•
•
•
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.
C++ Syntax (Toggle Plain Text)
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; }
Where do you define the function YesNo()?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
I didnt =/, i thought it was included in a library, heres the full code if you want to take a look
C++ Syntax (Toggle Plain Text)
#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. Oy! There's a lotta weird strangeness going on there.
[edit]It looks like you tried to grab this function here. Poke around up that thread a bit and see how that code got working.
Well, you'll need to define one then, or else don't use it.
C++ Syntax (Toggle Plain Text)
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();
[edit]It looks like you tried to grab this function here. Poke around up that thread a bit and see how that code got working.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
No, I meant this stuff. 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.
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();
This looks like a creature from another language with all the successive use of the comma operator.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Perhaps you missed my edit.
•
•
•
•
Originally Posted by Dave Sinkula
[edit]It looks like you tried to grab this function here. Poke around up that thread a bit and see how that code got working.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
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
and looks like everythings running perfectly, i took out the YesNo() aswell because it overly wasnt needed, thanks alot for your help.
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
C++ Syntax (Toggle Plain Text)
char check; scanf(" %c", &check); getchar(); if (check=='Y'||check=='y')
![]() |
Similar Threads
Other Threads in the C++ Forum
- Previous Thread: bin trees
- Next Thread: Singly-Linked Lists: Ultimate
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






