Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error - ambiguous reference to linear_at() #41

Closed
BsAtHome opened this issue Apr 15, 2022 · 4 comments
Closed

Compile error - ambiguous reference to linear_at() #41

BsAtHome opened this issue Apr 15, 2022 · 4 comments

Comments

@BsAtHome
Copy link

The current git version cannot build on my Fedora 35 machine. The MVE part builds just fine, but the smvs (this part) cannot compile.
The call to method linear_at() is ambiguous, referring to two possible targets. Can you please advise which is the correct one?

The error:

[myhomedir@marvin ~/tarapps]$ make -C smvs
make: Entering directory '/home/myhomedir/tarapps/smvs'
make -C lib
make[1]: Entering directory '/home/myhomedir/tarapps/smvs/lib'
g++ -Wall -Wextra -Wundef -pedantic -march=native -funsafe-math-optimizations -fno-math-errno -std=c++11 -g -O3 -pthread -I../../mve/libs -I../lib -march=native -pthread  -c -MM bicubic_patch.cc correspondence.cc delaunay_2d.cc depth_optimizer.cc depth_triangulator.cc gauss_newton_step.cc global_lighting.cc light_optimizer.cc mesh_generator.cc mesh_simplifier.cc sgm_stereo.cc sse_vector.cc stereo_view.cc surface.cc surface_derivative.cc surface_patch.cc view_selection.cc >Makefile.dep
g++ -Wall -Wextra -Wundef -pedantic -march=native -funsafe-math-optimizations -fno-math-errno -std=c++11 -g -O3 -pthread -I../../mve/libs -I../lib -march=native -pthread  -c -o bicubic_patch.o bicubic_patch.cc
g++ -Wall -Wextra -Wundef -pedantic -march=native -funsafe-math-optimizations -fno-math-errno -std=c++11 -g -O3 -pthread -I../../mve/libs -I../lib -march=native -pthread  -c -o correspondence.o correspondence.cc
g++ -Wall -Wextra -Wundef -pedantic -march=native -funsafe-math-optimizations -fno-math-errno -std=c++11 -g -O3 -pthread -I../../mve/libs -I../lib -march=native -pthread  -c -o delaunay_2d.o delaunay_2d.cc
g++ -Wall -Wextra -Wundef -pedantic -march=native -funsafe-math-optimizations -fno-math-errno -std=c++11 -g -O3 -pthread -I../../mve/libs -I../lib -march=native -pthread  -c -o depth_optimizer.o depth_optimizer.cc
depth_optimizer.cc: In member function ‘void smvs::DepthOptimizer::reproject_neighbor(std::size_t)’:
depth_optimizer.cc:736:40: error: call of overloaded ‘linear_at(double&, double&, int)’ is ambiguous
  736 |                     subimage->linear_at(proj[0], proj[1], 0);
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ../../mve/libs/mve/image_io.h:16,
                 from depth_optimizer.cc:13:
../../mve/libs/mve/image.h:94:7: note: candidate: ‘T mve::Image::linear_at(float, float, int64_t) const [with T = float; int64_t = long int]’
   94 |     T linear_at (float x, float y, int64_t channel) const;
      |       ^~~~~~~~~
../../mve/libs/mve/image.h:101:10: note: candidate: ‘void mve::Image::linear_at(float, float, T*) const [with T = float]’
  101 |     void linear_at (float x, float y, T* px) const;
      |          ^~~~~~~~~
depth_optimizer.cc:738:40: error: call of overloaded ‘linear_at(double&, double&, int)’ is ambiguous
  738 |                     subimage->linear_at(proj[0], proj[1], 0);
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ../../mve/libs/mve/image_io.h:16,
                 from depth_optimizer.cc:13:
../../mve/libs/mve/image.h:94:7: note: candidate: ‘T mve::Image::linear_at(float, float, int64_t) const [with T = float; int64_t = long int]’
   94 |     T linear_at (float x, float y, int64_t channel) const;
      |       ^~~~~~~~~
../../mve/libs/mve/image.h:101:10: note: candidate: ‘void mve::Image::linear_at(float, float, T*) const [with T = float]’
  101 |     void linear_at (float x, float y, T* px) const;
      |          ^~~~~~~~~
depth_optimizer.cc:740:40: error: call of overloaded ‘linear_at(double&, double&, int)’ is ambiguous
  740 |                     subimage->linear_at(proj[0], proj[1], 0);
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ../../mve/libs/mve/image_io.h:16,
                 from depth_optimizer.cc:13:
../../mve/libs/mve/image.h:94:7: note: candidate: ‘T mve::Image::linear_at(float, float, int64_t) const [with T = float; int64_t = long int]’
   94 |     T linear_at (float x, float y, int64_t channel) const;
      |       ^~~~~~~~~
../../mve/libs/mve/image.h:101:10: note: candidate: ‘void mve::Image::linear_at(float, float, T*) const [with T = float]’
  101 |     void linear_at (float x, float y, T* px) const;
      |          ^~~~~~~~~
depth_optimizer.cc: In member function ‘double smvs::DepthOptimizer::mse_for_patch(std::size_t)’:
depth_optimizer.cc:779:51: error: call of overloaded ‘linear_at(double&, double&, int)’ is ambiguous
  779 |             grad_sub[0] = sub_gradients->linear_at(proj[0], proj[1], 0);
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ../../mve/libs/mve/image_io.h:16,
                 from depth_optimizer.cc:13:
../../mve/libs/mve/image.h:94:7: note: candidate: ‘T mve::Image::linear_at(float, float, int64_t) const [with T = float; int64_t = long int]’
   94 |     T linear_at (float x, float y, int64_t channel) const;
      |       ^~~~~~~~~
../../mve/libs/mve/image.h:101:10: note: candidate: ‘void mve::Image::linear_at(float, float, T*) const [with T = float]’
  101 |     void linear_at (float x, float y, T* px) const;
      |          ^~~~~~~~~
depth_optimizer.cc: In member function ‘double smvs::DepthOptimizer::ncc_for_patch(std::size_t, std::size_t)’:
depth_optimizer.cc:886:44: error: call of overloaded ‘linear_at(double&, double&, int)’ is ambiguous
  886 |         color_sub[0] = sub_image->linear_at(proj[0], proj[1], 0);
      |                        ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ../../mve/libs/mve/image_io.h:16,
                 from depth_optimizer.cc:13:
../../mve/libs/mve/image.h:409:1: note: candidate: ‘T mve::Image::linear_at(float, float, int64_t) const [with T = float; int64_t = long int]’
  409 | Image::linear_at (float x, float y, int64_t channel) const
      | ^~~~~~~~
../../mve/libs/mve/image.h:101:10: note: candidate: ‘void mve::Image::linear_at(float, float, T*) const [with T = float]’
  101 |     void linear_at (float x, float y, T* px) const;
      |          ^~~~~~~~~
make[1]: *** [../../mve/Makefile.inc:29: depth_optimizer.o] Error 1
make[1]: Leaving directory '/home/myhomedir/tarapps/smvs/lib'
make: *** [Makefile:3: all] Error 2
make: Leaving directory '/home/myhomedir/tarapps/smvs'
@flanggut
Copy link
Owner

Hi! Can you please not which compiler you are using?

The output of g++ --version should be enough.

@BsAtHome
Copy link
Author

Here you are:

$ g++ --version
g++ (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and OS (fully updated):

$ cat /etc/redhat-release 
Fedora release 35 (Thirty Five)

The problem seems to be the value of zero (0) as argument which apparently can be interpreted as a pointer, as the template suggests, instead of the integer in the other cases.

@flanggut
Copy link
Owner

Thanks! Should be fixed with 2083c7b.

@BsAtHome
Copy link
Author

Confirmed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants