Closed Susko3 closed 1 year ago
This isn't a bug. The obs-frontend-api block is specifically commented out in the CMakeLists.txt file, and it even tells you how to enable it:
# Uncomment these lines if you want to use the OBS Frontend API in your plugin
#[[
...
#]]
You're supposed to remove the #[[
and #]]
lines to enable linking your plugin against obs-frontend-api.
You're supposed to remove the
#[[
and#]]
lines to enable linking your plugin against obs-frontend-api.
Does it work for you? To me it gives a CMake syntax parse error. I think those are just markers to the reader to know what "these lines" refer to.
=> Configuring obs-plugintemplate...
CMake Error at CMakeLists.txt:31:
Parse error. Expected a command name, got bracket argument with text
"find_package(obs-frontend-api REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::obs-frontend-api)
".
-- Configuring incomplete, errors occurred!
Exception: C:\Users\Susko3\code\git\obs-plugintemplate\.github\scripts\Build-Windows.ps1:101
Line |
101 | Build
| ~~~~~
| cmake -S . -B build_x64 -G Visual Studio 17 2022 -DCMAKE_SYSTEM_VERSION=10.0.20348.0 -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=RelWithDebInfo
| -DCMAKE_PREFIX_PATH:PATH=C:\Users\Susko3\code\git\obs-build-dependencies\plugin-deps-2022-08-02-qt6-x64 -DQT_VERSION=6 exited with non-zero code 1.
You're supposed to remove the
#[[
and#]]
lines to enable linking your plugin against obs-frontend-api.Does it work for you? To me it gives a CMake syntax parse error. I think those are just markers to the reader to know what "these lines" refer to.
If you are trying to use the obs-frontend-api, you are absolutely supposed to remove #[[
and #]]
, which are CMake comment blocks. This is mentioned in the comment above them, which states:
# Uncomment these lines if you want to use the OBS Frontend API in your plugin
you are absolutely supposed to remove #[[ and #]], which are CMake comment blocks.
Okay that makes sense, my editor doesn't properly support them so I was confused about it. Works wonders now, thanks!
Operating System Info
Windows 10
Other OS
No response
OBS Studio Version
Other
OBS Studio Version (Other)
plugin-deps-2022-08-02-qt6-x64
OBS Studio Log URL
-
OBS Studio Crash Log URL
No response
Expected Behavior
I would expect the template to build fine when using functions from
obs-frontend-api.h
.Current Behavior
The build fails with:
Steps to Reproduce
plugin-main.c
like so, just adding a simple obs frontend event callback:include "plugin-macros.generated.h"
void callback(enum obs_frontend_event event, void* data) { (void)data;
}
OBS_DECLARE_MODULE() OBS_MODULE_USE_DEFAULT_LOCALE(PLUGIN_NAME, "en-US")
bool obs_module_load(void) { blog(LOG_INFO, "plugin loaded successfully (version %s)", PLUGIN_VERSION);
}
void obs_module_unload() { obs_frontend_remove_event_callback(callback, 0);
}