# Undefined reference to FLAC and vorbis when running makefile

**URL:** <https://forum.juce.com/t/undefined-reference-to-flac-and-vorbis-when-running-makefile/60058>\
**Category:** Linux\
**Created:** [February 19, 2024, 8:28pm UTC](https://forum.juce.com/t/undefined-reference-to-flac-and-vorbis-when-running-makefile/60058 "2024-02-19T20:28:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knotalun](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@knotalun](https://forum.juce.com/u/knotalun)\
**Post date:** [February 19, 2024, 8:28pm UTC](https://forum.juce.com/t/undefined-reference-to-flac-and-vorbis-when-running-makefile/60058/1 "2024-02-19T20:28:51Z")

</div>

Hello there,

I’ve decided to start transitioning to using Cmake as I’ve begun daily driving Linux but I’m quite a beginner at it.

I’ve currently just started trying out compiling the example AudioPlugin in JUCE/examples/CMake, but I’ve had almost no luck with it. I’ve managed to get the build tree up and running, but when I run the actual makefile, it starts for a bit and then crashes. Some snippets of the error message include

> juce\_audio\_formats.cpp:(.text.\_ZN4juce10FlacReaderC2EPNS\_11InputStreamE[\_ZN4juce10FlacReaderC5EPNS\_11InputStreamE]+0xb0): undefined reference to `FLAC\_\_stream\_decoder\_new’

and

> juce\_audio\_formats.cpp:(.text.\_ZN4juce9OggWriterC2EPNS\_12OutputStreamEdjjiRKNS\_15StringPairArrayE[\_ZN4juce9OggWriterC5EPNS\_12OutputStreamEdjjiRKNS\_15StringPairArrayE]+0xd6): undefined reference to `vorbis\_info\_init’

I think I’m missing some sort of FLAC and OGG modules. I’ve tried installing FLAC through apt, but the error still remains.

As I said, I’m a beginner with CMake, so this is what I have for my top-level CMakeLists.txt. I’ve tried following the API documentation as closely as possible, but I still feel a little confused by it.

```auto
cmake_minimum_required(VERSION 3.22)
project(TestCMake VERSION 1.0.0)
find_package(JUCE CONFIG REQUIRED)
add_subdirectory(AudioPlugin)

```

It’s quite frustrating having to struggle with the build process, so any help at this point would be great appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![baramgb](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/baramgb/32/12822_2.png) [@baramgb](https://forum.juce.com/u/baramgb)\
**Post date:** [February 20, 2024, 1:57am UTC](https://forum.juce.com/t/undefined-reference-to-flac-and-vorbis-when-running-makefile/60058/2 "2024-02-20T01:57:06Z")

</div>

Okay, let’s find out how this works. At first you make a project folder and enter it:

`mkdir myplugin && cd myplugin`

clone the juce framework with git.

`git clone https://github.com/juce-framework/JUCE.git`

Now copy the cmake audio plug-in example to your project folder:

`cp JUCE/examples/CMake/AudioPlugin/* .`

Edit the CmakeLists.txt and uncomment line 26, so cmake will find juce.

Make a build folder and enter it:

`mkdir build && cd build`

Now you should be able to build the project:

```auto
cmake ..
make

```

This is only a starting point and should give you a idea of how this works.

---

<div class="post-metadata">

**Author:** ![knotalun](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@knotalun](https://forum.juce.com/u/knotalun)\
**Post date:** [February 20, 2024, 4:28pm UTC](https://forum.juce.com/t/undefined-reference-to-flac-and-vorbis-when-running-makefile/60058/3 "2024-02-20T16:28:17Z")

</div>

Thanks for the specific line number. I missed it the first time around cause most of the cmake file was just comments. I’ve gotten this working with the global path as well.

Cheers.
