in function main':
binary_to_decimal()'
[linker error] undefined reference to
[linker error] undefined reference `decimal_to_binary()'
working on decimal binary , binary decimal program. unfortunately ran compiling errors lack knowledge fix. appreciate fix , learn issue.
here source code of program.
#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 - binary decimal" << std::endl; std::cout << "enter 2 - decimal 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 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 binary is: " << std::bitset<32>(decimal_to_binary_var); std::cout << std::endl; }
case sensitive problem!
void binary_to_decimal(); --> void binary_to_decimal(); ^ ^ void decimal_to_binary(); --> void decimal_to_binary(); ^ ^
compiler searches void binary_to_decimal()
implelemted void binary_to_decimal();
different thing.
Comments
Post a Comment