Syntax Error
-
Hallo,
ich bin in C++ ganz neu und habe deswegen noch einige Probleme mit der Syntax. Ich habe zwei Klassen geschrieben und möchte sie jetzt testen in einem Main-Programm. Es kommt aber ein Fehler, bei dem ich keine Idee habe wie ich es beseitigen soll. Hier das Programm:#include "Angles.h"
#include "Point.h"
#include <iostream>
#include <vector>int main()
{
std::vector<double> v (3);
cloud_geometry::Point::Point p1 (1f,2f,3f);for(int i = 0; i<length.v; i++)
{
v(i) = (double) rand();
}
Point p2 (1f,1f,3f);
flipNormalTowardsViewpoint(v, p1, p2);}
Der Syntax Error lautet: testmain.cpp(9) : error C2146: syntax error : missing ';' before identifier 'p1'
Vielen Dank für Eure Hilfe!!!
-
Zeig mal die Klasse von cloud_geometry::Point::Point...
-
Hier .cpp und .h :
#include "Vision/3DFeatures/Point.h"
using namespace cloud_geometry;
Point::Point(float a, float b, float c)
:x(a), y(b), z(c)
{
}Header-Datei:
#ifndef __Point_H__
#define __Point_H__namespace cloud_geometry
{
class Point
{
public:
Point(float, float, float);
~Point(void);
float x, y, z;
};
}
#endif
-
Der ctor und dtor werden automatisch beim anlegen eines Objektes aufgerufen. Also nur:
cloud_geometry::Point p1(1.0f,2.0f,3.0f);
-
Vielen Dank!!! Der Fehler ist weg