我有以下的cpp文件,并错误“宣言预计”在此行中被抛出,在“为”指点:C++:错误“申报预期”
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.
}
有没有人看到我出错的地方?
你有一些错别字:缺少分号,'iNumClass'而不是'uNumClass'。你能复制粘贴你真正想要编译的东西吗? – lolando
有几行错误,但不是那一行。也许你可以发布你正在编译的确切代码,以及确切的错误消息? –
这个问题是非常基本的,但这不能保证-5票。以代码为例,他已经清楚地表达了这个问题,并努力尝试自己解决它(如底部的评论所示)。 +1取消一些反对票。 – JBentley