c2064 problem-- namespace issue??

J

Jon

Hello all,

Basic question. I have a vector/matrix class I'm building, and I seem
to be getting errors such as this:

..\otherFileUsingVectorMatrixClass.cpp(182) : error C2064: term does
not evaluate to a function

the specs are such:

vec3f.h:
Vec3f
{
...
public:
...

// calculate dot product
friend float dot( const Vec3f&, const Vec3f& );
};
-------------
vec3f.cpp:
float dot( const Vec3f &a, const Vec3f &b )
{ return a[0]*b[0] + ...; }
-------------
vecMatClass.h

#include "vec2f.h"
#include "vec3f.h"
#include "vec4f.h"
#include "mat3f.h"
#include "mat4f.h"
-------------
someOtherFileUsingVectorMatrixClass.cpp:

#include "vecMatClass.h"

void Class::foo()
{
Vec3f a( 2,3,4 ), b( 5,3,2 );
const float dotP = dot( a, b );
}




Am I missing something? I'm using MSVC++ 6 and its compiler. I tried
to look up namespaces and such, and saw really old posts saying the
compiler had trouble recognizing functions in namespaces, or something
along those lines.

For a large program, is it ok to "pollute" the global namespace with
such functions as dot() (and there are 3 versions of it, for Vec2f,
Vec3f, and Vec4f)?


Thank you,
Jon
 
J

Jonathan Mcdougall

Hello all,
Basic question. I have a vector/matrix class I'm building, and I seem
to be getting errors such as this:

.\otherFileUsingVectorMatrixClass.cpp(182) : error C2064: term does
not evaluate to a function

What is this line?
the specs are such:

vec3f.h:
Vec3f

What is that?
{
...
public:
...

// calculate dot product
friend float dot( const Vec3f&, const Vec3f& );
};
vec3f.cpp:
float dot( const Vec3f &a, const Vec3f &b )
{ return a[0]*b[0] + ...; }

vecMatClass.h

#include "vec2f.h"
#include "vec3f.h"
#include "vec4f.h"
#include "mat3f.h"
#include "mat4f.h"

What are these?
-------------
someOtherFileUsingVectorMatrixClass.cpp:

#include "vecMatClass.h"

void Class::foo()

What is that ?
{
Vec3f a( 2,3,4 ), b( 5,3,2 );
const float dotP = dot( a, b );
}




Am I missing something?

Yes, you should post compilable code, not just try to rewrite it.
For a large program, is it ok to "pollute" the global namespace with
such functions as dot() (and there are 3 versions of it, for Vec2f,
Vec3f, and Vec4f)?

afaik, there was no namespaces in your program.


Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top