错误:'std'之前的预期初始化程序

时间:2012-09-25 09:08:37

标签: c++ std

anisha@linux-trra:~> make
g++ -c -m64 -pipe -I/usr/lib64/R/include -I/usr/lib64/R/library/Rcpp/include -I/usr/lib64/R/library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/home/anisha/qtsdk-2010.05/qt/mkspecs/linux-g++-64 -I. -I/home/anisha/qtsdk-2010.05/qt/include/QtCore -I/home/anisha/qtsdk-2010.05/qt/include/QtGui -I/home/anisha/qtsdk-2010.05/qt/include -I. -o zoomCornerPanDatabaseParser.o zoomCornerPanDatabaseParser.cpp
In file included from zoomCornerPanDatabaseParser.h:9:0,
                 from zoomCornerPanDatabaseParser.cpp:1:
*******************boundaryLineEquation.cpp:6:1: error: expected initializer before ‘std’
make: *** [zoomCornerPanDatabaseParser.o] Error 1

.cpp

#include <math.h>
#include <string>
#include "boundaryLineEquation.h"

/// This function will return the direction of the new point as w.r.t to the given rectangle.
********************std :: string findPanDirection (float x1, float y1, float x2, float y2, float newX, float newY)
{
    if (x1 > x2)
    {
        float temp = x1;
        x1 =x2;
        x2 = temp;
    }

    if (y2 > y1)
    {
        float temp = y2;
        y2 = y1;
        y1 = temp;
    }

    if (newX < x1 )
    {

.h

#include <iostream>

#ifndef RLINE
#define RLINE

std :: string findPanDirection (float x1, float y1, 
                        float x2, float y2, 
                        float newX, float newY);

bool returnDistance (float centerPointLng, float centerPointLat, 
                float newCenterPointLng, float newCenterPointLat)

#endif

2 个答案:

答案 0 :(得分:6)

;声明中遗漏returnDistance()。应该是:

bool returnDistance (float centerPointLng, float centerPointLat, 
                     float newCenterPointLng, float newCenterPointLat);
                                                                    //^

答案 1 :(得分:2)

你需要一个分号

bool returnDistance (float centerPointLng, float centerPointLat, 
                     float newCenterPointLng, float newCenterPointLat);
                                                                      ^