cycfi / q

C++ Library for Audio Digital Signal Processing
MIT License
1.12k stars 146 forks source link

Not able to compile the examples #39

Closed erstan closed 2 years ago

erstan commented 2 years ago

I'm using g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 on WSL2 and can't compile the examples in the Q/example directory.

Here's what I did so far.

Finally, I navigated to the Q/example directory and tried to compile the sin_synth.cpp file using g++. But, it gives a compilation error.

$ g++ sin_synth.cpp
/usr/bin/ld: /tmp/ccdapcKc.o: in function `main':
sin_synth.cpp:(.text+0x3a): undefined reference to `cycfi::q::port_audio_stream::start()'
/usr/bin/ld: sin_synth.cpp:(.text+0x55): undefined reference to `cycfi::q::port_audio_stream::stop()'
/usr/bin/ld: /tmp/ccdapcKc.o: in function `sin_synth::sin_synth(cycfi::q::frequency)':
sin_synth.cpp:(.text._ZN9sin_synthC2EN5cycfi1q9frequencyE[_ZN9sin_synthC5EN5cycfi1q9frequencyE]+0x33): undefined reference to `cycfi::q::port_audio_stream::port_audio_stream(unsigned long, unsigned long, int, int)'
/usr/bin/ld: sin_synth.cpp:(.text._ZN9sin_synthC2EN5cycfi1q9frequencyE[_ZN9sin_synthC5EN5cycfi1q9frequencyE]+0x55): undefined reference to `cycfi::q::port_audio_stream::sampling_rate() const'
/usr/bin/ld: sin_synth.cpp:(.text._ZN9sin_synthC2EN5cycfi1q9frequencyE[_ZN9sin_synthC5EN5cycfi1q9frequencyE]+0x7f): undefined reference to `cycfi::q::port_audio_stream::~port_audio_stream()'
/usr/bin/ld: /tmp/ccdapcKc.o: in function `sin_synth::~sin_synth()':
sin_synth.cpp:(.text._ZN9sin_synthD2Ev[_ZN9sin_synthD5Ev]+0x26): undefined reference to `cycfi::q::port_audio_stream::~port_audio_stream()'
/usr/bin/ld: /tmp/ccdapcKc.o:(.data.rel.ro._ZTI9sin_synth[_ZTI9sin_synth]+0x10): undefined reference to `typeinfo for cycfi::q::port_audio_stream'
collect2: error: ld returned 1 exit status

I wonder if I am missing any flags that I need to pass with g++.

djowel commented 2 years ago

:-) OK, I just got to inspect this today. You should use make, instead of compiling the individual cpp files :-)

CD to the build dir and try: make