2016-05-04 30 views
-2

2つの配列を作成し、それらを入力、出力、追加、比較する関数を使用する必要がありますが、エラーメッセージ:undefined reference to outputVLI(int*, int)が続きます。私はこれが何を意味するのか、それをどう解決するのかは分かりません。すべてのヘルプはoutputVLIへの未定義の参照?

#include <iostream> 
using namespace std; 

const int maxDigits = 100; 
void inputVLI (int vli[], int size); // Inputs the very long integers 
void outputVLI (int vli[], int size); // Outputs the very long integers 
void addVLI (const int vli1[], const int vli2[], int vli3[], int size1, int size2, int& size3); // Adds the very long integers together 
int compVLI (const int vli1, const int vli2, int size1, int size2); // Compares the very long integers 

int main() 
{ 
    int vli1[maxDigits], vli2[maxDigits], vli3[maxDigits], size1, size2, size3; 
    inputVLI (vli1, maxDigits);         // Calls the individual functions 
    outputVLI (vli1, maxDigits);        // | 
    inputVLI (vli2, maxDigits);         // | 
    outputVLI (vli2, maxDigits);        // | 
    /*addVLI (vli1, vli2, vli3, size1, size2, size3);   // | 
    compVLI (vli1, vli2, size1, size2);*/      // \/ 
    return 0; 
} 

void inputVLI(int vli[], int size) 
{ 
    cout << "Enter a very long integer" << endl; 
    cin >> vli[maxDigits]; 
} 

void output (int vli[], int size) 
{ 
    for (int i=maxDigits; i>=0; i--) 
     cout << vli[i]; 
} 

void addVLI (const int vli1[], const int vli2[], int vli3[], int size1, int size2, int& size3) 
{ 
/* 
    for (int i=0; i<maxDigits; i++) 
    { 
     vli3[i]=vli1[i] + vli2[i]; 
     cout << "The sum of the vli's is:" << vli3[i] << endl; 
    } 
*/ 
} 

int compVLI (const int vli1, const int vli2, int size1, int size2) 
{ 
/* 
    for (int i=0; vli1[maxDigits] && vli2[maxDigits]; i++) 
    { 
     if (vli1[maxDigits] != vli2[maxDigits]) 
     { 
      return (-1); // -1 is not equal 
     } 
     return (1); // 1 is equal 
    } 
*/ 
} 

答えて

0

あなたoutputVLI機能がdeclared, but not definedでいただければ幸いです。だから、あなたが定義を追加する必要があります

void outputVLI(int vli[], int size) { 
    // TODO: implementation here 
} 

また、あなたのcompVLIの関数は値を返す必要があります...

+0

私は、あなたが何を意味するか、それが定義されていないノウハウを知らないのですか? – awpirates9

+0

私がリンクしている答えを見てください。関数(つまり 'void foo();')を宣言する必要があり、関数(つまり 'void foo(){}')を定義する必要があります。関数を使用する前に関数を定義すると、宣言をスキップできます。 – miha