micknoise / Maximilian

C++ Audio and Music DSP Library

Home Page:http://www.maximilian.strangeloop.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmake build (in command line section) not working

shakfu opened this issue · comments

I've tried on a RPI and on OS X and I get the same error trying to compile via make:

commandline me$ mkdir build
commandline me$ cd build/
build me$ cmake ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/me/Downloads/src/Maximilian/cpp/commandline/build
build me$ make
[ 20%] Building CXX object CMakeFiles/maximilian.dir/main.cpp.o
/Users/me/Downloads/src/Maximilian/cpp/commandline/main.cpp:205:41: error:
      non-const lvalue reference to type 'vector<double>' cannot bind to an
      initializer list temporary
    double seq = idx.pull(trig, seqidx, {0,1,2,3,4,5,6,7,8,9});
                                        ^~~~~~~~~~~~~~~~~~~~~
/Users/me/Downloads/src/Maximilian/cpp/commandline/../../src/maximilian.h:1597:72: note:
      passing argument to parameter '_values' here
    double pull(const double trigSig, double indexSig, DOUBLEARRAY_REF _values)
                                                                       ^
/Users/me/Downloads/src/Maximilian/cpp/commandline/../../src/maximilian.h:733:10: warning:
      private field 'firstRun' is not used [-Wunused-private-field]
    bool firstRun = 1;
         ^
/Users/me/Downloads/src/Maximilian/cpp/commandline/../../src/maximilian.h:1225:12: warning:
      private field 'phase' is not used [-Wunused-private-field]
    double phase = 0;
           ^
2 warnings and 1 error generated.
make[2]: *** [CMakeFiles/maximilian.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/maximilian.dir/all] Error 2
make: *** [all] Error 2
build me$ ls

Ok, I think I figured it out manual (non-cmake) compilation (after watching a youtube video from 2015).

You have to copy everything in Maximilian/src into the Maximilian/cpp/commandline folder, and then use the appropriate command line compilation sequence as follows (in the case of linux/ALSA):

g++ -std=c++17 -Wall -D__LINUX_ALSA__ -o maximilian main.cpp RtAudio.cpp player.cpp maximilian.cpp -lasound -lpthread

You can substitute main.cpp with the examples accordingly.

Note that the -std=c++17 has been added otherwise you get compilation errors.

The documentation should reflect this. obviously.