debug 编译出错,并且随便修改一处代码就编译成功。
清理解决方案后,debug编译又出错,是怎么回事。release编译正常。
1>p4221.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall Checking::Checking(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,double)" (??0Checking@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@N@Z),该符号在函数 _main 中被引用
account.h
checking.h
savings.h
account.cpp
checkings.cpp
savings.cpp
p4421.txt
savings123 70000
checking661 20000
savings128 2000
savings131 5000
checking681 200000
checking688 10000
x 0
withdrawal.txt
savings123 5000
savings131 5060
checking661 30000
checking688 1000
x 0
1>p4221.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall Checking::Checking(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,double)" (??0Checking@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@N@Z),该符号在函数 _main 中被引用
account.h
#ifndef HEADER_ACCOUNT
#define HEADER_ACCOUNT
#include<string>
using namespace std;
class Account{
string acntNumber;
public:
double balance;
Account(string acntNo,double balan=0);
virtual void display()const;
virtual void withdrawal1();
};
#endifchecking.h
#ifndef HEADER_CHECKING
#define HEADER_CHECKING
#include<iostream>
#include"account.h"
using namespace std;
class Checking:public Account{
public:
Checking(string acntNo,double balan=0.0);
void withdrawal1();
void display()const;
};
#endifsavings.h
#ifndef HEADER_SAVING
#define HEADER_SAVING
#include<iostream>
#include"account.h"
class Savings:public Account{
static int minBalance;
public:
Savings(string acntNo,double balan=0.0):Account(acntNo,balan){}
void display()const;
void withdrawal1();
};
#endifaccount.cpp
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
#include"account.h"
Account::Account(string acntNo,double balan):acntNumber(acntNo),balance(balan){}
void Account::display()const{
cout<<"Account:"+acntNumber+"="<<balance<<"\n" ;
}
void Account::withdrawal1(){
ifstream inwithdrawal1("c:\\withdrawal.txt",ios::in);
string acntNo1;int amount1;
for(;inwithdrawal1>>acntNo1>>amount1; )
if(!((acntNo1=="x")&&(amount1==0))){
if(acntNumber==acntNo1){
balance-=amount1;
}
}
}checkings.cpp
#include"checkings.h"
#include <iostream>
using namespace std;
Checking::Checking(string acntNo,double balan):Account(acntNo,balan){}//,remittance(other)
void Checking::display()const{
cout<<"Checking ";
Account::display();
}
void Checking::withdrawal1(){
Account::withdrawal1();
}#include"checkings.h"
#include"savings.h"
//#include<iostream>
#include<fstream>
#include<string>
#include<vector>
using namespace std;
int main(){
vector<Savings*> sav;
vector<Checking*> chec;
ifstream in("c:\\p4421.txt",ios::in);
string acntNo;double amount;
for(;in>>acntNo>>amount;)//
{
if(!(acntNo=="x"&&amount==0))
if(!((static_cast<int>(acntNo.find("savings"))==-1)))
{ (sav.push_back(new Savings(acntNo,amount)));}
else
{
(chec.push_back(new Checking(acntNo,amount)));
}
}
for(vector<Savings*>::iterator it=sav.begin();it!=sav.end();++it){
(*it)->display();
(*it)->withdrawal1();
(*it)->display();
}
for(vector<Checking*>::iterator it=chec.begin();it!=chec.end();it++){
(*it)->display();
(*it)->withdrawal1();
(*it)->display();
}
for(vector<Savings*>::iterator it=sav.begin();it!=sav.end();it++)
delete *it;
for(vector<Checking*>::iterator it=chec.begin();it!=chec.end();it++)
delete *it;
system("pause");
}savings.cpp
#include"savings.h"
int Savings::minBalance=0;
void Savings::display()const{
cout<<"Savings ";
Account::display();
}
void Savings::withdrawal1(){
Account::withdrawal1();
}p4421.txt
savings123 70000
checking661 20000
savings128 2000
savings131 5000
checking681 200000
checking688 10000
x 0
withdrawal.txt
savings123 5000
savings131 5060
checking661 30000
checking688 1000
x 0
...全文
相关推荐
为什么debug编译不出错,而release编译会出错
在 Debug 模式下,编译器会插入调试信息,以便于开发者调试程序;而在 Release 模式下,编译器会优化代码,删除调试信息,以提高程序的运行速度。
Debug时修改代码能即时生效.
首先,让我们了解为什么在Debug时代码的即时生效如此重要。在传统的开发工作流程中,如果开发者在Debug过程中需要修改代码,通常需要进行编译、打包、重启应用服务器等一系列操作才能看到修改后的效果。
VC++6.0debug使用技巧/编译时出错示例与原因分析
### VC++6.0 Debug使用技巧与编译时出错示例及原因分析#### 一、概述本文旨在分享作者在使用Visual C++ 6.0过程中积累的一些经验,特别是针对Debug技巧以及如何理解并解决编译时出现的各种错误
编译QWT的DEBUG版本
**编辑qwtconfig.pri文件**:为了支持DEBUG版本的编译,需要修改`qwtconfig.pri`文件中的配置。
Spring官方源码最新编译成功之后的代码,可以直接导入idea直接debug
资源描述:1.Spring官方源码最新编译成功之后的代码,可以直接导入idea直接debug2.资源内容:spring-framework20220311.zip3.学习目标:了解spring底层原理


