Connecting Tech Pros Worldwide Help | Site Map

c2064 problem-- namespace issue??

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 19th, 2005, 06:55 PM
Jon
Guest
 
Posts: n/a
Default c2064 problem-- namespace issue??

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

  #2  
Old July 19th, 2005, 06:56 PM
Jonathan Mcdougall
Guest
 
Posts: n/a
Default Re: c2064 problem-- namespace issue??

> Hello all,[color=blue]
>
> 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[/color]

What is this line?
[color=blue]
> the specs are such:
>
> vec3f.h:
> Vec3f[/color]

What is that?
[color=blue]
> {
> ...
> public:
> ...
>
> // calculate dot product
> friend float dot( const Vec3f&, const Vec3f& );
> };[/color]
[color=blue]
> 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"[/color]

What are these?
[color=blue]
> -------------
> someOtherFileUsingVectorMatrixClass.cpp:
>
> #include "vecMatClass.h"
>
> void Class::foo()[/color]

What is that ?
[color=blue]
> {
> Vec3f a( 2,3,4 ), b( 5,3,2 );
> const float dotP = dot( a, b );
> }
>
>
>
>
> Am I missing something?[/color]

Yes, you should post compilable code, not just try to rewrite it.
[color=blue]
> 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)?[/color]

afaik, there was no namespaces in your program.


Jonathan


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.