错误:“std”之前的预期初始值设定项

error: expected initializer before ‘std’

本文关键字:std 错误      更新时间:2023-10-16
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

声明中缺少returnDistance() ;。应该是:

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

一个分号

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