我有以下cpp文件,并在此行中抛出错误“Declaration expected”,指向“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.
}
有人看到我哪里出错吗?
答案 0 :(得分:9)
您指明的行没有错误。错误是:
m_Floats
的声明)。iNumClass
和uNumClass
的声明(可能是他们在你没有向我们展示的标题中)答案 1 :(得分:4)
m_floats
声明后,你错过了一个分号。尝试:
vector<float>m_Floats;
答案 2 :(得分:2)
可能的拼写错误,
mat1[i] = new float[iNumClass];
应该是
mat1[i] = new float[uNumClass];