0

I'm currently attempting to compile a VST3 plugin (or any C++ code, for that matter) for the first time, mainly just following Steinberg's own tutorial for all things except the actual sound processing. Attempting to compile throws an "unresolved external symbol" error:

Error   LNK2019 unresolved external symbol "public: __cdecl VSTGUI::VST3Editor::VST3Editor(class Steinberg::Vst::EditController *,char const *,char const *)" (??0VST3Editor@VSTGUI@@QEAA@PEAVEditController@Vst@Steinberg@@PEBD1@Z) referenced in function "public: virtual class Steinberg::IPlugView * __cdecl Itisdud::Split_TimesController::createView(char const *)" (?createView@Split_TimesController@Itisdud@@UEAAPEAVIPlugView@Steinberg@@PEBD@Z)    Split_Times D:\programme\VST3Dev\Split_times\Split_Times\build\split_timescontroller.obj    1   

The function that causes this, createView, is still the default it is when created by the Project Generator:

IPlugView* PLUGIN_API Split_TimesController::createView (FIDString name)
{
    // Here the Host wants to open your editor (if you have one)
    if (FIDStringsEqual (name, Vst::ViewType::kEditor))
    {
        // create your editor here and return a IPlugView ptr of it
        auto* view = new VSTGUI::VST3Editor (this, "view", "split_timeseditor.uidesc");
        return view;
    }
    return nullptr;
}

Copying the createView function from the again and adelay samples didn't work either.

As the Project generator only includes vstgui4/vstgui/plugin-bindings/vst3editor.h and not the vst3editor.cpp file, I tried including that as well (As I've read that not having the actual implementation there might be the cause of the issue), however that didn't fix the issue but made a lot of other errors happen upon compiling.

I also tried to follow this, including the cpp files noted there and changing the createView function to what is written there, however this also only led to there being a bit more than 300 errors upon compiling.

Copying the includes from the again sample didn't work either.

What would I need to include for this to work?

Itisdud
  • 41
  • 7

1 Answers1

0

Those are the linker errors as you didn't instruct the linker where to find the required library files whose functions you are using.

Remember that compilation is a 2-step process that involves compilation and linking so it is best to separate them.

Lets assume you are using Visual Studio on Windows, and lets assume your VST SDK is installed on

C:\VST3SDK.

The first thing you should do is fire-up Visual Studio and select File->Open->CMake and go locate the CMake.txt file here

C:\VST3SDK\VST3_SDK.

After this file is loaded you will find on Visual Studio Solution Explorer a list of ready-made projects that come with the VST SDK loaded.

You will find that one of these projects is called Libraries and that is THE first action you have to do.

Now you have to build the correct library depending on whether you want to make 32-bits or 64-bits VSTs and you should set the configuration of the Libraries project accordingly.

You will build these libraries and if you hadn't changes any setting the libraries will be found at

C:\VST3SDK\VST3_SDK\out\build\x64-Debug\lib 

or

C:\VST3SDK\VST3_SDK\out\build\x64-Release\lib

the necessary libraries being:

base.lib
pluginterfaces.lib
sdk.lib
sdk_common.lib
sdk_hosting.lib
vstgui.lib
vstgui_standalone.lib
vstgui.support.lib
vstgui_uidescription.lib

The above step ensures that you now have the necessary library files your VSTs will depend on.

Now assuming you have a VST sample project, lets say that you got from Git-hub and that it were written and setup correctly to run on Visual Studio, i.e. it came with a

myVST.vcxproj file.

Then you could paste the following pragmas on a prominent VST file such as the factory.cpp

#pragma comment(lib, "base.lib")
#pragma comment(lib, "pluginterfaces.lib")
#pragma comment(lib, "sdk.lib")
#pragma comment(lib, "sdk_common.lib")
#pragma comment(lib, "sdk_hosting.lib")
#pragma comment(lib, "vstgui.lib")
#pragma comment(lib, "vstgui_standalone.lib")
#pragma comment(lib, "vstgui_support.lib")
#pragma comment(lib, 
"vstgui_uidescription.lib") 

(Had to abbreviate due to confusing formatting requirements of this site but replace like "vstgui.lib" with a fully qualified path like "C:/VST3SDK/VST3_SDK/out/build/x64-Debug/lib/vstgui.lib"

Now if your project properties

C/C++ _> General _> Additional Include Directories has correct entries that will tell the compiler the paths it will find ALL the #include files, then you will find that if you right click on any compilable file (c, cpp, rc ...) and select Compile then the file should successfully compile into an object file without any Compiler errors otherwise it is an indication that the compiler cannot find the required header files.

But the problem you face are the linker problems, the linker can not find the required libraries of functions you have used in your project and the solution is just pasting the pragmas above.

Dharman
  • 30,962
  • 25
  • 85
  • 135
khalfan
  • 23
  • 6