在函数Binary_to_Decimal()'
[链接器错误] 未定义对 `Decimal_to_Binary()' 的引用
处理十进制到二进制和二进制到十进制程序。不幸的是,我遇到了我缺乏修复知识的编译错误。我将非常感谢帮助解决和了解该问题。
这是程序的源代码。main':
[Linker error] undefined reference to
#include <iostream>
#include <string>
#include <bitset>
void Binary_to_Decimal();
void Decimal_to_Binary();
int main (int argv, char argc) {
while(1<2){
int m_Choice;
std::cout << "Enter 1 - for Binary to Decimal" << std::endl;
std::cout << "Enter 2 - for Decimal to Binary" << std::endl;
std::cin >> m_Choice;
if (m_Choice == 1) {
Binary_to_Decimal();
}else if (m_Choice == 2) {
Decimal_to_Binary();
}
return 0;
}
}
void Binary_To_Decimal(){
std::string Binary_to_Decimal_cstr;
std::cout << "Please enter binary number: " << std::endl;
std::cin>>Binary_to_Decimal_cstr;
std::cout<<Binary_to_Decimal_cstr;
std::cout <<"converted to Decimal is:" << std::bitset<32>(Binary_to_Decimal_cstr).to_ulong();
std::cout << std::endl;
}
void Decimal_To_Binary(){
int Decimal_to_Binary_Var;
std::cout << "Please enter Decimal number: " << std::endl;
std::cin >> Decimal_to_Binary_Var;
std::cout << Decimal_to_Binary_Var;
std::cout << "converted to Binary is: " << std::bitset<32>(Decimal_to_Binary_Var);
std::cout << std::endl;
}