Error LNK2019: unresolved external symbol "class juce::AudioProcessor

I just started coding C++ to get into VST’s and really know nothing about compiling or coding in C++ for that matter as I normally code in python.

I get this error when running cmake --build . --config Debug
Only thing is I have the createpluginfilter() within my code as follows:

#include “PluginProcessor.h”

juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{
return new FrequencyShiftAudioProcessor();
}

It’s within its own file under pluginentry.cpp. Originally I had it within PluginProcessor.cpp and did not work there either. Any help to this problem would be appreciated cause I can’t figure it out for the life of me.

I’ll link my cmakelist:

cmake_minimum_required(VERSION 3.15)

Project setup

project(BinauralShifter VERSION 1.0.0 DESCRIPTION “A binaural audio processing plugin”)

Enable debug symbols and set build type if not specified

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

Include JUCE

add_subdirectory(JUCE)

Set C++ standard

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Plugin configuration

set(PROJECT_NAME “BinauralShifter”)
set(COMPANY_NAME “LaudriLabs”)
set(PLUGIN_NAME “Binaural Shifter”)
set(PLUGIN_DESCRIPTION “Binaural audio processing plugin”)
set(PLUGIN_VERSION “1.0.0”)

Define source files

set(SOURCE_FILES
Source/PluginProcessor.cpp
Source/PluginProcessor.h
Source/PluginEditor.cpp
Source/PluginEditor.h
Source/GranularShifter.h
Source/Parameters.h
Source/AudioLogger.h
Source/PluginEntry.cpp
)

Plugin setup

juce_add_plugin(${PROJECT_NAME}
VERSION ${PLUGIN_VERSION}
COMPANY_NAME ${COMPANY_NAME}
PRODUCT_NAME ${PLUGIN_NAME}
DESCRIPTION ${PLUGIN_DESCRIPTION}
PLUGIN_MANUFACTURER_CODE LLBS
PLUGIN_CODE Bshf
FORMATS VST3 Standalone # Added Standalone format for easier testing
VST3_CATEGORIES “Fx”
IS_SYNTH FALSE
NEEDS_MIDI_INPUT FALSE
NEEDS_MIDI_OUTPUT FALSE
IS_MIDI_EFFECT FALSE
EDITOR_WANTS_KEYBOARD_FOCUS FALSE
COPY_PLUGIN_AFTER_BUILD TRUE # Automatically copy to system VST folder
SOURCES ${SOURCE_FILES}
)

Add required JUCE modules

target_compile_definitions(${PROJECT_NAME}
PUBLIC
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_REPORT_APP_USAGE=0
$<$CONFIG:Debug:JUCE_DEBUG=1>
)

Set optimization flags for Release builds

if(CMAKE_BUILD_TYPE STREQUAL “Release”)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/O2>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-O3>
)
endif()

Link JUCE libraries

target_link_libraries(${PROJECT_NAME}
PRIVATE
juce::juce_audio_utils
juce::juce_audio_processors
juce::juce_audio_plugin_client
juce::juce_dsp
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)

Generate JUCE header files

juce_generate_juce_header(${PROJECT_NAME})

Install targets

include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Terminal error:

<obscured_path>/build>cmake --build . --config Debug
MSBuild version 17.9.5+33de0b227 for .NET Framework

  Checking File Globs
  1>Checking Build System
  Generating BinauralShifter_artefacts/JuceLibraryCode/BinauralShifter_resources.rc
  Building Custom Rule <obscured_path>/CMakeLists.txt
  BinauralShifter_rc_lib.vcxproj -> <obscured_path>/build/BinauralShifter_rc_lib.dir/Debug/BinauralShifter_rc_lib.lib
  Generating BinauralShifter_artefacts/JuceLibraryCode/JuceHeader.h
  Building Custom Rule <obscured_path>/CMakeLists.txt
  juce_audio_processors.cpp
  juce_audio_processors_ara.cpp
  juce_audio_processors_lv2_libs.cpp
  juce_gui_extra.cpp
  juce_gui_basics.cpp
  juce_graphics.cpp
  juce_graphics_Harfbuzz.cpp
  juce_events.cpp
  juce_core.cpp
  juce_core_CompilationTime.cpp
  juce_data_structures.cpp
  juce_audio_basics.cpp
  juce_audio_utils.cpp
  juce_audio_formats.cpp
  juce_audio_devices.cpp
  juce_dsp.cpp
<obscured_path>/juce_gui_basics.cpp(61): warning : This version of JUCE does not use the splash screen, the flag JUCE_DISPLAY_SPLASH_SCREEN is ignored [<obscured_path>/build/BinauralShifter.vcxproj]
  juce_graphics_Sheenbidi.c
  BinauralShifter.vcxproj -> <obscured_path>/build/BinauralShifter_artefacts/Debug/Binaural Shifter_SharedCode.lib
  Building Custom Rule <obscured_path>/CMakeLists.txt
  juce_VST3ManifestHelper.cpp
  juce_vst3_helper.vcxproj -> <obscured_path>/build/Debug/juce_vst3_helper.exe
  Building Custom Rule <obscured_path>/CMakeLists.txt
  juce_audio_plugin_client_AAX.cpp
  juce_audio_plugin_client_AAX_utils.cpp
  juce_audio_plugin_client_ARA.cpp
  juce_audio_plugin_client_LV2.cpp
  juce_audio_plugin_client_Standalone.cpp
  juce_audio_plugin_client_Unity.cpp
  juce_audio_plugin_client_VST2.cpp
  juce_audio_plugin_client_VST3.cpp
     Creating library <obscured_path>/build/BinauralShifter_artefacts/Debug/VST3/Binaural Shifter.lib and object <obscured_path>/build/BinauralShifter_artefacts/Debug/VST3/Binaural Shifter.exp
juce_audio_plugin_client_VST3.obj : error LNK2019: unresolved external symbol "class juce::AudioProcessor * __cdecl createPluginFilter(void)" (?createPluginFilter@@YAPEAVAudioProcessor@juce@@XZ) referenced in function "class std::unique_ptr<class juce::AudioProcessor,struct std::default_delete<class juce::AudioProcessor> > __cdecl juce::createPluginFilterOfType(enum juce::AudioProcessor::WrapperType)" (?createPluginFilterOfType@juce@@YA?AV?$unique_ptr@VAudioProcessor@juce@@U?$default_delete@VAudioProcessor@juce@@@std@@@std@@W4WrapperType@AudioProcessor@1@@Z) [<obscured_path>/build/BinauralShifter_VST3.vcxproj]
<obscured_path>/build/BinauralShifter_artefacts/Debug/VST3/Binaural Shifter.vst3 : fatal error LNK1120: 1 unresolved externals [<obscured_path>/build/BinauralShifter_VST3.vcxproj]

<obscured_path>/build>cmake --build . -v  --config Debug
Change Dir: '<obscured_path>/build'

Run Build Command(s): "<compiler_path>/MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
MSBuild version 17.9.5+33de0b227 for .NET Framework
Build started 12/11/2024 7:27:16 AM.

Project "<obscured_path>/build/ALL_BUILD.vcxproj" on node 1 (default targets).
Project "<obscured_path>/build/ALL_BUILD.vcxproj" (1) is building "<obscured_path>/build/ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
InitializeBuildStatus:
  Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
  Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
PreBuildEvent:
  Checking File Globs
  setlocal
  "<compiler_path>/cmake.exe" -P "<obscured_path>/build/CMakeFiles/VerifyGlobs.cmake"
  if %errorlevel% neq 0 goto :cmEnd
  :cmEnd
  endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
  :cmErrorLevel
  exit /b %1
  :cmDone
  if %errorlevel% neq 0 goto :VCEnd
  :VCEnd
CustomBuild:
  All outputs are up-to-date.
FinalizeBuildStatus:
  Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
  Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "<obscured_path>/build/ALL_BUILD.vcxproj" (default targets) -- FAILED.

Build FAILED.

"<obscured_path>/build/ALL_BUILD.vcxproj" (default target) (1) ->
"<obscured_path>/build/BinauralShifter_VST3.vcxproj" (default target) (3) ->
(Link target) ->
  juce_audio_plugin_client_VST3.obj : error LNK2019: unresolved external symbol "class juce::AudioProcessor * __cdecl createPluginFilter(void)" (?createPluginFilter@@YAPEAVAudioProcessor@juce@@XZ) referenced in function "class std::unique_ptr<class juce::AudioProcessor,struct std::default_delete<class juce::AudioProcessor> > __cdecl juce::createPluginFilterOfType(enum juce::AudioProcessor::WrapperType)" (?createPluginFilterOfType@juce@@YA?AV?$unique_ptr@VAudioProcessor@juce@@U?$default_delete@VAudioProcessor@juce@@@std@@@std@@W4WrapperType@AudioProcessor@1@@Z) [<obscured_path>/build/BinauralShifter_VST3.vcxproj]
  <obscured_path>/build/BinauralShifter_artefacts/Debug/VST3/Binaural Shifter.vst3 : fatal error LNK1120: 1 unresolved externals [<obscured_path>/build/BinauralShifter_VST3.vcxproj]

Done Building Project "<obscured_path>/build/BinauralShifter_VST3.vcxproj" (default targets) -- FAILED.

Done Building Project "<obscured_path>/build/ALL_BUILD.vcxproj" (default targets) -- FAILED.

Build FAILED

It doesn’t seem to compile any of your own source files, only the JUCE ones.

On a closer look, juce_add_plugin doesn’t have a SOURCES argument, which you are using to add your sources. Do this instead:

target_sources( ${PROJECT_NAME} PRIVATE
    Source/PluginProcessor.cpp
    Source/PluginProcessor.h
    Source/PluginEditor.cpp
    Source/PluginEditor.h
    Source/GranularShifter.h
    Source/Parameters.h
    Source/AudioLogger.h
    Source/PluginEntry.cpp
)