Hello,
I'm having a problem with a line of code that doesn't seem to be working right. I have no idea why it keeps telling me I have a missing ';' before '-'. Any help would be appreciated. Here's the error in Visual Studio:


: error C2143: syntax error : missing ';' before '-'
: error C2433: 'Point::Vector' : 'inline' not permitted on data declarations
: error C2501: 'Point::Vector' : missing storage-class or type specifiers

#include <iostream>
#include <GL/glut.h>

using namespace std;

class Point{
public: 
	float  x, y, z; 
	inline Point  (){};
	inline Point  (float, float, float);              // initialization of vectors
	inline Point  operator+ (const Point &p) const;   // addition of points
	inline Vector operator- (const Point &p) const;   // subtraction of points (returns vector)	<-- ERROR
}; 
 
class Vector{
public:
	float x, y, z, w;
	inline Vector (){};
	inline Vector (float, float, float);             // initialization of vectors
	inline Vector operator+ (const Vector &v) const; // addition of vectors
	inline Vector operator- (const Vector &v) const; // subtraction of vectors
	inline Vector operator* (const Vector &v) const; // multiplication of vectors
	inline Vector operator* (const Point &p)  const; // multiplication of vector and scalar
	inline Vector operator! () const;                // negation of vectors
};

int main(int argc, char **argv)
{
	return 0;
}// end main

Recommended Answers

All 2 Replies

Add a forward reference for class Vector?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.