質問

[OK]をので、私は自分のコードに問題把握をしようと問題を抱えています。私は私がコンパイル時にめちゃくちゃにされている関連する部分を投稿するつもりですので、私は多くのコードを持っています。私はクラスの次の関数の内部を持っており、それがコンパイルされますと、私は「CalculateProbabilityResults」関数を呼び出すと、それはそれ内のコードの7行を実行するまで、すべてがうまく実行されます。あなたはそれが簡単に見つけることができますので、私は私のプログラムにこのコード行を「脱コメント」しました。私はそれはとてもそれが問題になることができない、かなり確信して、私は関数を呼び出していないとき、それは罰金をコンパイルするため、必要に応じて右の#includeディレクティブを持つことができますよ?私は私と一緒にクマを喜ば、私の名前の表記法のいくつかは少しの助けを必要と知っています。ヘルプみんなのために事前に感謝します。

int SQLServer::CalculateProbabilityResults(int profile, int frame, int time_period, int TimeWindowSize) {
    ofstream ResultFile;
    stringstream searchFileName;
    stringstream outputName;
    vector<vector<int>> timeFrameItemsets;
    int num = getTimeFrameFile(frame*TimeWindowSize, TimeWindowSize);
    cout << num << endl;

    //outputName << "Results" << getTimeFrameFile((frame*TimeWindowSize), TimeWindowSize) << ".csv";
    cout << outputName.str() << endl;
    outputName.clear();
    //ResultFile.open(outputName.str().c_str());
    ResultFile.close();
    result.resize(0);
    return 0;
}

int getTimeFrameFile(int timeInHours, int timeFrameSize) {
    int fileNum = 0;
    int testWin;
    if (timeInHours > 24) {
        while (timeInHours >24)
            timeInHours -= 24;
    }
    for (testWin = 0; testWin < 24/timeFrameSize; testWin++) {
        if (timeInHours >= testWin*timeFrameSize && timeInHours < (testWin+1)*timeFrameSize)
            fileNum = testWin+1;
    }
    if (fileNum == 0)
        fileNum = testWin+1;
    return fileNum;
}

コールログ

1>------ Rebuild All started: Project: MobileSPADE_1.3, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'MobileSPADE_1.3', configuration 'Debug|Win32'
1>Compiling...
1>main.cpp
1>MobileSPADE.cpp
1>SQLServer.cpp
1>Generating Code...
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>Linking...
1>LINK : C:\Users\JoshBradley\Desktop\MobileSPADE_1.3\MobileSPADE_1.3\Debug\MobileSPADE_1.3.exe not found or not built by the last incremental link; performing full link
1>SQLServer.obj : error LNK2019: unresolved external symbol "public: int __thiscall SQLServer::getTimeFrameFile(int,int)" (?getTimeFrameFile@SQLServer@@QAEHHH@Z) referenced in function "public: int __thiscall SQLServer::CalculateProbabilityResults(int,int,int,int)" (?CalculateProbabilityResults@SQLServer@@QAEHHHHH@Z)
1>C:\Users\JoshBradley\Desktop\MobileSPADE_1.3\MobileSPADE_1.3\Debug\MobileSPADE_1.3.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\JoshBradley\Desktop\MobileSPADE_1.3\MobileSPADE_1.3\MobileSPADE_1.3\Debug\BuildLog.htm"
1>MobileSPADE_1.3 - 2 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
役に立ちましたか?

解決

コンパイラはgetTimeFrameFileは、SQLServerの方法だと思います:

  

未解決の外部シンボル "パブリック:int型__thiscall ののSQLServerの :: getTimeFrameFile(int型、int型)"

しかし、あなたはそれが無料の関数として定義されています:

int getTimeFrameFile(int timeInHours, int timeFrameSize) {

:この問題を解決する無料の関数からクラスメソッドにすることを

変更

int SQLServer::getTimeFrameFile(int timeInHours, int timeFrameSize)

他のヒント

getTimeFrameFile上の機能SQLServer::CalculateProbabilityResultsを置きます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top