### Unresolved Externals?

So I've written out a program that is supposed to convert hexadecimal numbers to normal numerals. however, i keep getting this error:

Error 6 error LNK2019: unresolved external symbol "double __cdecl cNum(char * const,int)" (?cNum@@YANQADH@Z) referenced in function _main c:\Users\Username\documents\visual studio 2012\Projects\HexAdder\Source.obj HexAdder

Anyone know what this means???

Here's my code for reference:
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687`` ``````#include #include using namespace std; void fill_array(char a[], int size); double cNum(char a[], int size); const int SIZE = 10; int main() { char hex1[SIZE], hex2[SIZE]; int number_used; double num1, num2; num1 = cNum(hex1, SIZE); fill_array(hex1, SIZE); for (int i = 0; i <= (SIZE - 1); i++) cout << hex1[i]; cout << endl << num1; system("pause"); return 0; } void fill_array(char a[], int size) { cout << "Enter a number in hexadecimal format up to 10 digits long\n" << "Mark the end with an asterisk(*)\n"; char next; int i = (size - 1); cin >> next; while (i >= 0) { if (next != '*') { a[i] = next; i--; cin >> next; } else { a[i] = '0'; i--; } } } double cNum(const char hex[], const int size) { double sum; char a[SIZE]; for (int i = 0; i < size; i++) { switch (hex[i]) { case '0': a[i] = 1; case '1': a[i] = 2; case '2': a[i] = 3; case '3': a[i] = 4; case '4': a[i] = 5; case '5': a[i] = 6; case '6': a[i] = 7; case '7': a[i] = 8; case '8': a[i] = 9; case '9': a[i] = 10; case 'a': a[i] = 11; case 'b': a[i] = 12; case 'c': a[i] = 13; case 'd': a[i] = 14; case 'e': a[i] = 15; case 'f': a[i] = 16; } a[i] = pow(16, i) * hex[i]; sum += a[i]; } return sum; }``````

Also, that switch is huge and unruly. Anyone have any other suggestions to converting?
Your prototype: `double cNum(char a[], int size);`

Your definition: `double cNum(const char hex[], const int size)`

They need to be the same.
Topic archived. No new replies allowed.