-3

次の cpp ファイルがあり、「宣言が必要です」というエラーがこの行にスローされ、「for」を指しています。

for (int i = 0; i < m_Floats.size(); ++i) 

コード全体は次のとおりです。

#include "stdafx.h"
#include <vector>
#include "clsJenksBreaks.h"

using namespace std;

vector<float>m_Floats

vector<float>getJenksBreaks(const unsigned int uNumClass)
{
    //std::sort(m_Floats, m_Floats + size, std::greater<float>());

    float **mat1 = new float*[m_Floats.size()];
    for (int i = 0; i < m_Floats.size(); ++i) 
    {
        mat1[i] = new float[iNumClass];
    }
    for (unsigned long x=0;x<uNumClass+1;x++)
    {
        for (unsigned long y=0;y<m_Floats.size()+1,y++)
        {
            mat1[x][y]=0;
        }
    }

    //I have commented out the other code that is in this function, but the error still exists.

}

誰かが私がどこで間違ったのか見ていますか?

4

3 に答える 3

9

あなたが示した行にエラーはありません。エラーは次のとおりです。

  • 7 行目の末尾にセミコロンがありません ( の宣言m_Floats)。
  • andの宣言がiNumClassありuNumClassません (おそらく、表示されていないヘッダーにあると思われます)
  • 20 行目の for ループ インクリメンタの前のセミコロンの代わりにコンマ。
于 2013-10-18T13:40:53.597 に答える
4

の宣言の後にセミコロンがありませんm_floats。試す:

vector<float>m_Floats;
于 2013-10-18T13:30:06.553 に答える