Unresolved external symbol _DllMainCRTStartup, and 2>LINK : fatal error LNK1104: cannot open file '<projectname>.lib'

I was trying to set up a very simple plugin with projucer, but encountered the following error when trying to compile the standalone version on Win64 VC2019:

2>LINK : fatal error LNK1104: cannot open file '<projectname>.lib'

Eventually, I learned that the fatal error

You are trying to use START_JUCE_APPLICATION in an audio plug-in. Define JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1 if you want to use a custom standalone target app.

actually was relevant, despite seeing on these forums that it wasn’t and could be ignored. At this point, I encountered the following error:

unresolved external symbol _DllMainCRTStartup

This prompted me to compile the AudioPluginDemo, which compiled perfectly on all fronts (but seems to be completely different from the project directory generated by projucer, for some reason). I then tried to compile my project with WSL, which of course worked perfectly, because Windows was developed by orangutans. Of course, I can’t run any linux-compiled VST3 project on my windows machine without Clara, so back to fiddling with VC2019. By this point I have also made sure that my settings in projucer for my project are identical to that of AudioPluginDemo’s. I have also given up on making a standalone and am compiling exclusively for project_VST3

After ample googling, I learn that DllMain is actually defined in juce_audio_plugin_client_VST3.cpp. Perfect; this is congruent with observations of AudioPluginDemo, which seems to have wrappers and include functions for this file in the VST3 solution. After copying the files from the JUCE module directory into my project directory (why are they not there by default if they’re integral pieces of code???), effectively copying the AudioPluginDemo_VST3 solution structure, the error seems to evolve into an error about not having vstfxstore.h. This is great, but I don’t care about VST2 and sure as hell don’t want to pay for a license, so I add JUCE_VST3_CAN_REPLACE_VST2=0 to my preprocessor definitions and be on my merry way. Except of course with this addition, a huge amount of errors occur, and on removal, the DllMain error is back - even after recreating the conditions that previously dispelled it.

Why in the lord’s name is projucer not just working out of the box? Why does it only work with the makefile? Is the VC2019 version broken? I am almost certain that my computer is fine. I’ve been trying to fix this for the better part of a day.

Since October 2018, Projucer creates new Audio Plug-in projects with JUCE_VST3_CAN_REPLACE_VST2 set to 0. So you shouldn’t have to add this yourself.

Great.

A) Why did anything change when I added it myself (other than maybe I just reloaded the JuceLibraryCode and messed up in putting the other required dependencies back)?
B) Why was I prompted for vstfxstore.h (very much a VST2 SDK piece of code) if I ostensibly never needed it?
C) That doesn’t fix my original issue, or tell me anything.

I learned that the DllMain error comes from the fact that by default, the juce_audio_plugin_client module is missing from the audio_plugin setup (???). You would think it would be important.

Reliably getting the vstfxstore.h error now, will reply when I solve that.

Edit: Oh, are you sure that JUCE_VST3_CAN_REPLACE_VST2=0 by default? Setting that to disabled (0) gives me a completely new error:

error LNK2019: unresolved external symbol "class juce::AudioProcessor * __cdecl createPluginFilter(void)" (?createPluginFilter@@YAPEAVAudioProcessor@juce@@XZ) referenced in function "class juce::AudioProcessor * __cdecl juce::createPluginFilterOfType(enum juce::AudioProcessor::WrapperType)" (?createPluginFilterOfType@juce@@YAPEAVAudioProcessor@1@W4WrapperType@21@@Z)

2>C:\Users\Administrator\Documents\<projectname>\Builds\VisualStudio2019\x64\Debug\VST3\\<projectname>.vst3 : fatal error LNK1120: 1 unresolved externals

Progress! I will return when I have solved this new conundrum (with seemingly no help from these forums).

These errors are all quite unusual - if I open Projucer, select ‘New Project’ from the ‘File’ menu, click the ‘plugin->basic’ option from the sidebar, then generate a project, this project builds without issues for me. I can also see in the ‘module’ selector in the new project window that the audio_plugin_client module is initially selected for a plugin project. I wonder whether you accidentally selected a different type of project when initially creating the project.

Would you mind trying to create a completely fresh project using the steps I outlined above?

Also, does your Projucer version definitely match the version of the JUCE codebase? You can find the Projucer version by selecting “About Projucer” from the menu. If you’re using JUCE 6.0.4, the Projucer version should also be 6.0.4.

I am a fool. A clown and a fool. Forgive me for all of my transgressions in this thread as I explain that I was working off of “application->audio” preset and not “plugin->basic”. I am using JUCE/Projucer 6.0.4. Just tried plugin->basic and it compiles seamlessly; I am filled with shame.

That being said, the tutorials are a little misleading, and don’t match up with my GUI (of course I should have figured it out anyway, but still). Also, why didn’t the “”“audio application”"" compile the first time anyway? It also seems strange that after selecting Audio Plug-in in the settings, and installing all the modules, it still didn’t compile. And why do the tutorials refer to filenames that exist in audio application and not basic plugin? Holdover from the last version? But whatever, these are tertiary questions.

Depending on the tutorial, the project may be an Audio Application project or a Plugin project. If the tutorial doesn’t make it clear, there should be a download of all the project code, including a jucer file. As a last resort you could check the example project to see how it’s configured.

If you made any changes to the project before initially building it, that could cause issues. In particular, the plugin_client module isn’t guaranteed to work in an audio app project. It’s difficult to be more specific without knowing the errors which are generated.

I hope that answers your questions, please let us know if you run into any more issues.