mercredi 23 janvier 2019

error I cannot resolve, I assume it has to do with return sequence

When compiling program build time error:

error: linker command cannot be resolved( use -v to see invocation) clang

I am under the impression it is an exit code issue, however I am having trouble resolving it.

The program looks like this:

  #include <iostream>
    #include <fstream>
    #include <vector>

    class suffixArray{
        int size;
    public: static std::vector<int> rank;


    public: suffixArray(std:: string concatenated ){

        size = (int)concatenated.length();
        rank.resize(size);
        char *suffixPointers[concatenated.length()];
        int value[concatenated.length()];



        for(int i =0; i <= concatenated.length()-1; i++){
            suffixPointers[i] = &concatenated[i];
            value[i] = (int)concatenated[i];

        }



        int currentRankIndex;
        int prevRankIndex;
        int currentRank;



        for (int current = 1 ; current <= size - 1; current++){
            if(current == 0){
                rank[current] = 0;
            }else if( value[current] > value[rank[current-1]]){
                rank.push_back(current);
            }else{
                currentRankIndex = current; //3 constant
                currentRank = current; //3
                while( value[currentRankIndex] <= value [rank[currentRank -1]] ){
                    prevRankIndex = rank[currentRank-1]; //2
                    rank[currentRank-1] = currentRankIndex;
                    rank[currentRank] = prevRankIndex;
                    currentRank--;

                }

            }

        }

    }
    };

int main( int argc, char* argv[]) {

    std:: string test = "banana$";
    suffixArray testString (test); 
    return 0;

}

I assume this error has to do with the return sequence not working, however I cannot understand why it would not be working. I also built the suffixArray class within the same file as main.

Aucun commentaire:

Enregistrer un commentaire