lakinduakash / linux-wifi-hotspot

Feature-rich wifi hotspot creator for Linux which provides both GUI and command-line interface. It is also able to create a hotspot using the same wifi card which is connected to an AP already ( Similar to Windows 10).
BSD 2-Clause "Simplified" License
3.21k stars 295 forks source link

4.3.0: error: reference to ‘size’ is ambiguous #203

Closed yochananmarqos closed 2 years ago

yochananmarqos commented 2 years ago

Describe the bug

linux-wifi-hotspot AUR package maitainer here. Just tried to build 4.3.0 adding qrencode as a dependency, but it failed.

mkdir -p build
Run 'sudo make install' for installation.
Run 'sudo make uninstall' for uninstallation.
cd src && make
make[1]: Entering directory '/build/linux-wifi-hotspot/src/linux-wifi-hotspot-4.3.0/src'
/usr/bin/glib-compile-resources ui/glade/wifih.gresource.xml --target=ui/resources.c --sourcedir=ui/glade --generate-source
make[2]: Entering directory '/build/linux-wifi-hotspot/src/linux-wifi-hotspot-4.3.0/src'
gcc -c -o ../build/main.o ui/main.c `pkg-config --cflags gtk+-3.0`
gcc -c -o ../build/ui.o ui/ui.c `pkg-config --cflags gtk+-3.0`
gcc -c -o ../build/h_prop.o ui/h_prop.c `pkg-config --cflags gtk+-3.0`
gcc -c -o ../build/util.o ui/util.c `pkg-config --cflags gtk+-3.0`
g++ -c -o ../build/read_config.o ui/read_config.cpp
gcc -c -o ../build/about_ui.o ui/about_ui.c `pkg-config --cflags gtk+-3.0`
gcc -c -o ../build/qr_ui.o ui/qr_ui.c `pkg-config --cflags gtk+-3.0`
g++ -c -o ../build/qrgen.o ui/qrgen.cpp
ui/qrgen.cpp: In function ‘int writePNG(QRcode*, const char*)’:
ui/qrgen.cpp:95:48: error: reference to ‘size’ is ambiguous
   95 |     realwidth = (qrcode->width + margin * 2) * size;
      |                                                ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
ui/qrgen.cpp:163:21: error: reference to ‘size’ is ambiguous
  163 | for(y=0; y<margin * size; y++) {
      |                     ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
ui/qrgen.cpp:173:19: error: reference to ‘size’ is ambiguous
  173 |     q += margin * size / 8;
      |                   ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
ui/qrgen.cpp:174:25: error: reference to ‘size’ is ambiguous
  174 |     bit = 7 - (margin * size % 8);
      |                         ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
ui/qrgen.cpp:176:22: error: reference to ‘size’ is ambiguous
  176 |         for(xx=0; xx<size; xx++) {
      |                      ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
ui/qrgen.cpp:186:18: error: reference to ‘size’ is ambiguous
  186 |     for(yy=0; yy<size; yy++) {
      |                  ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
ui/qrgen.cpp:192:21: error: reference to ‘size’ is ambiguous
  192 | for(y=0; y<margin * size; y++) {
      |                     ^~~~
In file included from /usr/include/c++/11.1.0/string:54,
                 from /usr/include/c++/11.1.0/bits/locale_classes.h:40,
                 from /usr/include/c++/11.1.0/bits/ios_base.h:41,
                 from /usr/include/c++/11.1.0/ios:42,
                 from /usr/include/c++/11.1.0/istream:38,
                 from /usr/include/c++/11.1.0/fstream:38,
                 from ui/qrgen.cpp:35:
/usr/include/c++/11.1.0/bits/range_access.h:254:5: note: candidates are: ‘template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])’
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11.1.0/bits/range_access.h:245:5: note:                 ‘template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)’
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
ui/qrgen.cpp:51:12: note:                 ‘int size’
   51 | static int size = 8;
      |            ^~~~
make[2]: *** [Makefile:38: ../build/qrgen.o] Error 1
make[2]: Leaving directory '/build/linux-wifi-hotspot/src/linux-wifi-hotspot-4.3.0/src'
make[1]: *** [Makefile:32: resources.c] Error 2
make[1]: Leaving directory '/build/linux-wifi-hotspot/src/linux-wifi-hotspot-4.3.0/src'
make: *** [Makefile:5: all] Error 2

Desktop (please complete the following information):

lakinduakash commented 2 years ago

That's so fast.. ;) Dependency is not qrencode. To build it needs libqrencode-dev and package dependency is libqrencode4 (for installing machine). I updated the dependencies in debian/control and README files. Can you please check that. Also v4.3.0 was removed. Check the v4.3.1

lakinduakash commented 2 years ago

Also needs libpng-dev and libpng-16 (package names in ubuntu repos)

yochananmarqos commented 2 years ago

On Arch it is indeed qrencodewhich depends on libpng. Remember, Arch keeps it simple.

Llnks to sonames:

libc.so.6 libpng16.so.16 libpthread.so.0 libqrencode.so.4

lakinduakash commented 2 years ago

So then it is a problem of size variable name. Can you try to rename size variable ( image_size ) and rebuild, if succeeded make a PR

lakinduakash commented 2 years ago

Check the last release?

yochananmarqos commented 2 years ago

All good with 4.3.2, thanks!