Q: linker error with a missing method

A

Arne Schmitz

Hi!

I get a mysterious linker error:

undefined reference to `Matrix<float>::eek:perator()(unsigned, unsigned)'

And I do not know why. I've got the following two operators defined and
declared:

T& operator()(size_t x, size_t y);
T operator()(size_t x, size_t y) const;

The library also gets linked to the executable, but the linking fails
anyway. Why? I thought size_t and unsigned are synonymous?

In my program code I use something like this:

Matrix<float> m; ...
m(i,j) = 1.0f;

Any ideas?

Arne
 
K

Kevin Goodsell

Arne said:
Hi!

I get a mysterious linker error:

undefined reference to `Matrix<float>::eek:perator()(unsigned, unsigned)'

And I do not know why. I've got the following two operators defined and
declared:

T& operator()(size_t x, size_t y);
T operator()(size_t x, size_t y) const;

The library also gets linked to the executable, but the linking fails
anyway. Why? I thought size_t and unsigned are synonymous?

In my program code I use something like this:

Matrix<float> m; ...
m(i,j) = 1.0f;

Any ideas?

The following FAQs might be relevant:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8
http://www.parashift.com/c++-faq-lite/containers-and-templates.html#faq-34.14

-Kevin
 
E

E. Robert Tisdale

Arne said:
I get a mysterious linker error:

undefined reference to `Matrix<float>::eek:perator()(unsigned, unsigned)'

And I do not know why.
I've got the following two operators defined and declared:

T& operator()(size_t x, size_t y);
T operator()(size_t x, size_t y) const;

The library also gets linked to the executable,
but the linking fails anyway.
Why? I thought size_t and unsigned are synonymous?

Evidently, Your compiler thinks so too.
In my program code I use something like this:

Matrix<float> m; ...
m(i,j) = 1.0f;

Any ideas?

I assume that templates exist somewhere for these operators.
But were they actually instantiated somewhere?
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top