How to correctly build plugins?

zabykrinich

New Member
I try to build frontend plugin for Windows in Visual Studio. I added my plugin files to OBS source directory to obs-studio\UI\frontend-plugins\MyPlugin.
Then inside MyPlugin directory I created CMakeLists.txt with all dependencies and includes I need.
CMake correctly creates me solution file with MyPlugin in projects. Build it as well without any problems.

Now the most interesting part: when I run debug from VisualStudio plugin appears in tools menu and works perfectly.
But when I try to put it to my installed obs-studio to obs-plugins\64bit\MyPlugin.dll I get following error in the log:

10:46:57.297: LoadLibrary failed for '../../obs-plugins/64bit/MyPlugin.dll': The specified procedure could not be found.
10:46:57.297: (127)
10:46:57.297: Module '../../obs-plugins/64bit/MyPlugin.dll' not found

I tried to build debug, RelWithDebInfo, Release, MinSizeRel variants. Nothing happens.
The same problem if I build frontend-tools or advanced-scene-switcher this way. It seems I make some mistake in building but can't find how to fix it.
Could you help me please? I can't even debug the problem since it is working in debugging.
Can it be some version of obs studio inconsistence? I use 19.0.3 latest and try to build from master sources.
 
I know there is a QT preprocessor flag when building release (QT_NO_DEBUG). It's under
Project->Properties->Configuration Properties->C/C++->Preprocessor
if you are using the VS2015 IDE (which it sounds like you're not).

I'm not sure how OBS likes debug plugins (because I'm lazy the plugins I've made just make releases), so you could try making a release with that flag.

Beyond that, I'm probably not much help.
 

zabykrinich

New Member
I know there is a QT preprocessor flag when building release (QT_NO_DEBUG). It's under
Project->Properties->Configuration Properties->C/C++->Preprocessor
if you are using the VS2015 IDE (which it sounds like you're not).

I'm not sure how OBS likes debug plugins (because I'm lazy the plugins I've made just make releases), so you could try making a release with that flag.

Beyond that, I'm probably not much help.

Hi adocilesloth thank you for the reply. Actually I use VS2015 IDE and it already set QT_NO_DEBUG inside Preprocessor Definitions. msbuild gives the same problem. I use QT 5.7.1 to build OBS studio also the same code is for 19.0.3 from master branch. Possible some directives are wrong.

WIN32;_WINDOWS;NDEBUG;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;HAVE_OBSCONFIG_H;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_NO_DEBUG;CMAKE_INTDIR="RelWithDebInfo";process_tracker_EXPORTS;%(PreprocessorDefinitions)

It seems that Error 127 points that some dependency lib is not present or has wrong version and dll can't load correct module.
 
Like I said, I doubt I can be much more help. Only things I can suggest, if it's a library problem, is to make sure you've linked all the libraries you need (although if you haven't the plugin wouldn't build) and if you are using any third party libraries, their .dlls are in
obs-studio/<version>/ (where <version> is 32bit or 64bit)
so the plugin can find them.

Also, make sure you have built the plugin for the correct version (32bit/64bit) and are launching the same version of OBS.

Stuff like this sounds simple but always catches me out when I'm not careful.
 
Top