I'm fairly new at C++, but I'm trying to read in a .las file. I'm sort of following this youtube video, but I'm still having some issues reading in the file.
I'm getting several errors:
error: prototype for 'int PointCloud::read(const string&)' does not match any in class 'PointCloud'|
candidate is: void PointCloud::read(const string&)|
expected declaration before '}' token|
error: prototype for 'int PointCloud::read(const string&)' does not match any in class 'PointCloud'|
error: candidate is: void PointCloud::read(const string&)|
error: expected declaration before '}' token|
Code:
#ifndef POINTCLOUD_H
#define POINTCLOUD_H
#include <stdint.h>
#include <string>
class PointCloud
{
public:
PointCloud(const std::string &path);
private:
struct Header
{
char magic[4];
uint16_t fileSourceID;
uint16_t globalEncoding;
uint32_t guidData1;
uint16_t guidData2;
uint16_t guidData3;
uint8_t guidData4;
uint8_t versionMaj, versionMin;
char systemIdentifier[32];
char genSoftware[32];
uint16_t creationDay, creationYear;
uint16_t headerSize;
uint32_t pointDataOffset;
uint32_t numVarLenRecords;
char pointDataFormat;
uint16_t pointDataRecordLen;
uint32_t pointRecordNum;
uint32_t pointReturnNum[5];
double scaleX, scaleY, scaleZ;
double offX, offY, offZ;
double maxX, maxY, maxZ;
double minX, minY, minZ;
};
void read(const std::string &path);
};
#endif //POINTCLOUD_H
#include "PointCloud.h"
#include <iostream>
#include <stdexcept>
#include <fstream>>
using namespace std;
PointCloud::read(const string &path)
{
ifstream inf(path, ios::binary);
if(inf.is_open())
{
Header header;
inf.read((char *))&header, sizeof(header));
cout << header.versionMaj << "," << header.versionMin << endl;
}
else
{
cout << "Error: No file found" << endl;
}
}
}
I'm not sure why it is complaining about the prototype I think I have everything right in the header. Also all the variables in the header struct come from this link.
Any help would be greatly appreciated. Thanks