flanggut / smvs

Shading-aware Multi-view Stereo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile error - ambiguous reference to linear_at()

BsAtHome opened this issue · comments

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'

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

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

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.

Thanks! Should be fixed with 2083c7b.

Confirmed, thanks!