C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 30th, 2012, 01:37 PM
somgoozy somgoozy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 somgoozy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m
Reputation Power: 0
LNK2019 Error in C++

My code:
#include "stdafx.h"
#include <iostream>
#include <iomanip>

using namespace std;

bool testPIN(int, int, int);
int countMatches(int, int, int);
const int maxPINSize=10;
int databasePIN [maxPINSize];
int custPIN [maxPINSize];

int main()
{
int size=0;
cout << "\nPlease set your PIN by entering a number then pressing enter. When finished, enter a negative one.\nThere is a limit of 10 numbers per PIN.\n" ;
while (databasePIN[size] != -1 && size != 9)
{
cin >> databasePIN[size];
size++;
cout << "\nDigit " << size << "has been set to " << databasePIN[size-1] << "!\n";

}
cout << "\nPlease enter your PIN again to confirm.\n";
size=0;
while (custPIN[size] != -1 && size != 9)
{
cin >> custPIN[size];
size++;
cout << "\nDigit "<< size << "has been set to " << databasePIN[size-1] <<"!\n";
}
if (testPIN( custPIN [maxPINSize], databasePIN [maxPINSize], size)==true)
cout <<"\nYour PIN numbers match and it has been saved .";
else cout << "\nYour PIN numbers did not match. Please restart the program and try again.";
}
bool testPIN(int custPIN[maxPINSize], int databasePIN[maxPINSize], int size)
{
if ( countMatches(custPIN [maxPINSize], databasePIN [maxPINSize], size)==size)
return true;
else return false;
}

int countMatches( int custPIN[maxPINSize], int databasePIN[maxPINSize], int size)
{
int count=0;
for (int index = 0; index < size; index++)
{
if (custPIN[index] == databasePIN[index])
count++;
}
return count;
}


My errors:
1>ConsoleApplication6.obj : error LNK2019: unresolved external symbol "bool __cdecl testPIN(int,int,int)" (?testPIN@@YA_NHHH@Z) referenced in function _main
1>ConsoleApplication6.obj : error LNK2019: unresolved external symbol "int __cdecl countMatches(int,int,int)" (?countMatches@@YAHHHH@Z) referenced in function "bool __cdecl testPIN(int * const,int * const,int)" (?testPIN@@YA_NQAH0H@Z)

Reply With Quote
  #2  
Old December 1st, 2012, 06:38 AM
p-jansson p-jansson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 5 p-jansson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 21 m 11 sec
Reputation Power: 0
Quote:
Originally Posted by somgoozy
My errors:
1>ConsoleApplication6.obj : error LNK2019: unresolved external symbol "bool __cdecl testPIN(int,int,int)" (?testPIN@@YA_NHHH@Z) referenced in function _main
1>ConsoleApplication6.obj : error LNK2019: unresolved external symbol "int __cdecl countMatches(int,int,int)" (?countMatches@@YAHHHH@Z) referenced in function "bool __cdecl testPIN(int * const,int * const,int)" (?testPIN@@YA_NQAH0H@Z)




Your functions need to be defined to accept three int's or else the linker will not find them. As they are written now, they want arrays.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > LNK2019 Error in C++


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap