[TriLUG] OT: C++ Question

Brian Henning brian at strutmasters.com
Tue Jan 31 10:24:24 EST 2006


The only thing I would suggest is trying
  	vector3d operator+ (const vector3d &);

I'm not at all certain, but the compiler may be expecting (requiring) a 
const reference as the argument to the overloaded operator declaration.

Worth a try, anyway.

~B

Randy Barlow wrote:
> Thanks Brian (and Tanner!)  This was definitely an issue in my code, but 
> I'm still having problems with the vector3d identifier in my point3d.h 
> file.  Here is point3d.h:
> 
> #pragma once
> #include "vector3d.h"
> 
> class point3d {
>     public:
>         double x, y, z;
>         point3d(double, double, double);
>         point3d(void);
>         ~point3d(void);
>         *point3d operator+ (vector3d);*
>         vector3d operator- (point3d);
>         double* operator [] (const int &);
> };
> 
> The compiler (OK, now it's OT since I am using the M$ Visual Studio, so 
> feel free to blast away at this post :)) complains, "c:\Documents and 
> Settings\Randy\My 
> Documents\research\discritizeCpp\discritize\point3d.h(10) : error C2061: 
> syntax error : identifier 'vector3d'"  Line 10 is the bolded line in the 
> code above.  Here is vector3d.h:
> 
> #pragma once
> #include "point3d.h"
> 
> class vector3d {
>     public:
>         double x, y, z;
>         vector3d(double, double, double);
>         vector3d(void);
>         ~vector3d(void);
>         vector3d cross(vector3d);
>         double dot(vector3d);
>         vector3d operator+ (vector3d);
>         vector3d operator- (vector3d);
>         vector3d operator- (point3d);
>         double* operator [] (const int &);
>         vector3d operator * (const double &);
> };
> 
> Why doesn't it like me using the identifier vector3d when I've included 
> the header file in which it is defined?  Thanks for all the help TriLUG!
> 
> -- 
> Randy Barlow
> Research Assistant
> Department of Electrical and Computer Engineering
> North Carolina State University, Raleigh, NC
> rpbarlow at ncsu.edu
> http://www.electronsweatshop.com
> 

-- 
----------------
Brian A. Henning
strutmasters.com
336.597.2397x238
----------------



More information about the TriLUG mailing list