rock-hopper / shuriken

Shuriken Beat Slicer
GNU General Public License v2.0
107 stars 6 forks source link

Does not compile using gcc 6.2 #8

Closed Baggypants closed 7 years ago

Baggypants commented 7 years ago

Build fails with following errors. Googling reveals this is to do with gcc 6.2

src/waveformitem.h:112:50: error: 'constexpr' needed for in-class initialization of static data member 'const qreal WaveformItem::DETA IL_LEVEL_MAX_CUTOFF' of non-integral type [-fpermissive] static const qreal DETAIL_LEVEL_MAX_CUTOFF = 0.05; src/waveformitem.h:113:56: error: 'constexpr' needed for in-class initialization of static data member 'const qreal WaveformItem::DET$ IL_LEVEL_VERY_HIGH_CUTOFF' of non-integral type [-fpermissive] static const qreal DETAIL_LEVEL_VERY_HIGH_CUTOFF = 1.0; ^~~ src/waveformitem.h:114:51: error: 'constexpr' needed for in-class initialization of static data member 'const qreal WaveformItem::DET$ IL_LEVEL_HIGH_CUTOFF' of non-integral type [-fpermissive] static const qreal DETAIL_LEVEL_HIGH_CUTOFF = 10.0; ^~~~ In file included from src/mainwindow.h:38:0, from src/main.cpp:24: src/audioanalyser.h:33:47: error: 'constexpr' needed for in-class initialization of static data member 'const qreal AudioAnalyser::MIN _INTER_ONSET_SECS' of non-integral type [-fpermissive] static const qreal MIN_INTER_ONSET_SECS = 0.05;

Here is a patch that seems to fix it

--- shuriken-0.5.1/src/audioanalyser.h 2015-09-27 15:58:36.000000000 +0100 +++ shuriken-0.5.1a/src/audioanalyser.h 2016-12-08 00:23:53.977421455 +0000 @@ -30,7 +30,7 @@ class AudioAnalyser { public:

rock-hopper commented 7 years ago

Hi, this has actually been fixed already in the master branch but the patch might be useful for others who want to build the most recent stable release.

diff -Naur shuriken-0.5.1a/src/audioanalyser.h shuriken-0.5.1b/src/audioanalyser.h
--- shuriken-0.5.1a/src/audioanalyser.h  2015-09-27 15:58:36.000000000 +0100
+++ shuriken-0.5.1b/src/audioanalyser.h  2016-12-08 00:23:53.977421455 +0000
@@ -30,7 +30,7 @@
 class AudioAnalyser
 {
 public:
-    static const qreal MIN_INTER_ONSET_SECS = 0.05;
+    static constexpr qreal MIN_INTER_ONSET_SECS = 0.05;

     struct DetectionSettings
     {
diff -Naur shuriken-0.5.1a/src/waveformitem.h shuriken-0.5.1b/src/waveformitem.h
--- shuriken-0.5.1a/src/waveformitem.h   2015-09-27 15:58:36.000000000 +0100
+++ shuriken-0.5.1b/src/waveformitem.h   2016-12-08 00:22:52.538422424 +0000
@@ -109,9 +109,9 @@

 private:
     static const int NOT_SET = -1;
-    static const qreal DETAIL_LEVEL_MAX_CUTOFF = 0.05;
-    static const qreal DETAIL_LEVEL_VERY_HIGH_CUTOFF = 1.0;
-    static const qreal DETAIL_LEVEL_HIGH_CUTOFF = 10.0;
+    static constexpr qreal DETAIL_LEVEL_MAX_CUTOFF = 0.05;
+    static constexpr qreal DETAIL_LEVEL_VERY_HIGH_CUTOFF = 1.0;
+    static constexpr qreal DETAIL_LEVEL_HIGH_CUTOFF = 10.0;

For anyone else reading this, save the above to a file named patch.diff then open a terminal in Shuriken's root directory and enter patch -p1 < ../patch.diff