1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 09:33:51 +03:00
latte-dock/containment
Rodrigo Pedra Brum 2b039e1275 Add const declarations on implementation files which use them as references
When trying to compile the new Multiple Screens feature released yesterday I got this error on KDE neon:

```bash
[ 83%] Building CXX object app/CMakeFiles/latte-dock.dir/lattedockadaptor.cpp.o
[ 84%] Linking CXX executable ../bin/latte-dock
/usr/bin/ld: CMakeFiles/latte-dock.dir/view/clonedview.cpp.o: in function `Latte::ClonedView::translateToClonesOrder(QList<int> const&)':
clonedview.cpp:(.text+0x1aaa): undefined reference to `Latte::ClonedView::ERRORAPPLETID'
collect2: error: ld returned 1 exit status
make[2]: *** [app/CMakeFiles/latte-dock.dir/build.make:2270: bin/latte-dock] Error 1
make[1]: *** [CMakeFiles/Makefile2:1806: app/CMakeFiles/latte-dock.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
```

After some research I found this StackOverflow answer:

https://stackoverflow.com/a/3026148

Which referenced this FAQ by Bjarne Stroustrup:

https://www.stroustrup.com/bs_faq2.html#in-class

In summary, if a `static const` is initialized in a class, and later is used as a reference in an implementation file, it should also be declared inside the implementation file. The initialization can live only inside the class.

Maybe the compiler used by @mvourlakos has an optimization to overcome such construct.

In my case by adding these two lines I could compile it on KDE neon (after fixing the first error, compilation failed on a second spot).
2022-01-17 15:41:44 +00:00
..
package update to v0.10.76 2022-01-16 22:09:49 +02:00
plugin Add const declarations on implementation files which use them as references 2022-01-17 15:41:44 +00:00
CMakeLists.txt fix #96,FEATURE:AllScreens and AllSecondaryScreens 2022-01-16 13:38:13 +02:00
Messages.sh use kde translations infrastructure 2017-09-08 12:02:52 +03:00
metadata.desktop.cmake SVN_SILENT made messages (.desktop file) - always resolve ours 2021-12-15 01:55:46 +00:00