2012-08-29 16 views
5

मैंने देखा है और मुझे पता है कि वहां अन्य जवाब हैं लेकिन उनमें से कोई भी मुझे जो कुछ भी ढूंढ रहा है उसे देने के लिए प्रतीत नहीं होता है, इसलिए कृपया इसे" रिपोस्ट "अनसुलझा बाहरी प्रतीक "सार्वजनिक: __thiscall

के रूप में रिपोर्ट न करें

मैं अनसुलझे बाह्य प्रतीक हो रही है।: मेरे सी ++ कोड में "सार्वजनिक __thiscall" त्रुटि और मैं के बारे में यह खिड़की से बाहर किक करने और सिर्फ अपनी सी ++ वर्ग असफल कर रहा हूँ कृपया मेरी मदद करो !!!!

मेरे खाता शीर्षलेख फ़ाइल

#include "BankAccount.h" 
class CheckingAccount 
{ 
private: 
int numOfWithdrawls; 
double serviceFee; 
int AccountBal; 

public: 
bool withdraw (double wAmmt); 
BankAccount CA; 
CheckingAccount(); 
CheckingAccount(int accountNum); 
}; 

और इसकी सीपीपी फ़ाइल

#include <iostream> 
using namespace std; 
#include "CheckingAccount.h" 

CheckingAccount::CheckingAccount() 
{ 
CA; 
numOfWithdrawls = 0; 
serviceFee = .50; 
} 
CheckingAccount::CheckingAccount(int accountNum) 
{ 
CA.setAcctNum (accountNum); 
numOfWithdrawls = 0; 
serviceFee = .50; 
} 
bool CheckingAccount::withdraw (double wAmmt) 
{ 
numOfWithdrawls++; 
if (numOfWithdrawls < 3) 
{ 
    CA.withdraw(wAmmt); 
} 
else 
{ 
    if (CA.getAcctBal() + .50 <=0) 
    { 
     return 0; 
    } 
    else 
    { 
     CA.withdraw(wAmmt + .50); 
     return 1; 
    } 
} 
} 

मेरे BankAccount हेडर फाइल

#ifndef BankAccount_h 
#define BankAccount_h 
class BankAccount 
{ 
private: 
int acctNum; 
double acctBal; 

public: 
BankAccount(); 
BankAccount(int AccountNumber); 
bool setAcctNum(int aNum); 
int getAcctNum(); 
double getAcctBal(); 
bool deposit(double dAmmt); 
bool withdraw(double wAmmt); 
}; 
#endif 

मेरे BankAccount सीपीपी फ़ाइल

#include <iostream> 
using namespace std; 
#include "BankAccount.h" 

BankAccount::BankAccount(int AccoutNumber) 
{ 
acctNum = 00000; 
acctBal = 100.00; 
} 
bool BankAccount::setAcctNum(int aNum) 
{ 
acctNum = aNum; 
return true; 
} 

int BankAccount::getAcctNum() 
{ 
return acctNum; 
} 

double BankAccount::getAcctBal() 
{ 
return acctBal; 
} 

bool BankAccount::deposit(double dAmmt) 
{ 
acctBal += dAmmt; 
return true; 
} 

bool BankAccount::withdraw(double wAmmt) 
{ 
if (acctBal - wAmmt <0) 
{ 
    return 0; 
} 
else 
{ 
    acctBal -= wAmmt; 
    return 1; 
} 
} 

मेरे त्रुटि:

1>BankAccountMain.obj : error LNK2019: unresolved external symbol "public: __thiscall BankAccount::BankAccount(void)" ([email protected]@[email protected]) referenced in function "public: __thiscall SavingsAccount::SavingsAccount(void)" ([email protected]@[email protected]) 

1>CheckingAccount.obj : error LNK2001: unresolved external symbol "public: __thiscall BankAccount::BankAccount(void)" ([email protected]@[email protected]) 
+0

जब आप इन प्रकार की त्रुटियों को देखते हैं, तो सुनिश्चित करें कि आप किसी LIB फ़ाइल से लिंक नहीं करना भूल रहे हैं। कभी-कभी हेडर जोड़ना पर्याप्त नहीं है, यहां तक ​​कि WinAPI सामान के लिए भी। –

उत्तर

18

"__thiscall" शोर है। पढ़ते रहिये। त्रुटि संदेश BankAccount::BankAccount(void) के बारे में शिकायत कर रहे हैं। हेडर फ़ाइल का कहना है कि BankAccount में एक डिफ़ॉल्ट कन्स्ट्रक्टर है, लेकिन इसकी कोई परिभाषा नहीं है।

+0

@ मैटवेस्टलेक - मुझे भावना पता है। उन त्रुटि संदेशों में बहुत सारी जानकारी है, लेकिन वे बल्कि घने हैं। –

+0

एमएस स्टूडियो अपने त्रुटि संदेशों में इतनी गुप्त क्यों है? अनावश्यक शोर क्यों? –

+1

@ जेवियर क्यूवेडो-फर्नांडेज़ - क्योंकि एक अलग संदर्भ में, "शोर" मायने रखता है। सार्थक त्रुटि संदेशों को उत्पन्न करने के लिए केवल इतना संकलक कर सकता है। एक अच्छा प्रोग्रामर बनने का एक हिस्सा त्रुटि संदेशों को समझना सीख रहा है। –

4

अपने BankAccount वर्ग में आप एक निर्माता है कि कोई तर्क लेता घोषित

BankAccount(); 

लेकिन आप इसे लागू नहीं करते हैं। यही कारण है कि लिंकर इसे नहीं ढूंढ सकता है। अपने .cpp फ़ाइल में इस कन्स्ट्रक्टर के लिए कार्यान्वयन प्रदान करें और लिंक चरण काम करना चाहिए।

+0

मैं कोड बहुत लंबा रास्ता देख रहा हूं ... ugh –

+0

@MattWestlake यह सबके साथ होता है। सामान्य लिंकर त्रुटियों में आम तौर पर मतलब है कि आप किसी फ़ंक्शन को कार्यान्वित करना भूल गए हैं या आप सही लाइब्रेरी से लिंक करने में विफल रहे हैं। ये आमतौर पर देखने के लिए पहली चीजें हैं। – mathematician1975

संबंधित मुद्दे