Hello,
Please forgive me if this is a relatively trivial question but I am new to Vala and don’t have any background in c/c++ either. Am I correct in thinking there must be a VAPI for any C library I want to use and they must have the same name?
After looking through the Vala API I saw a sdl2 API and thought I would try put together a simple example. Looks like the only VAPI is for sdl not sdl2. Does the VAPI’s not all ship with Valac?
I also see examples of Vala applications for OpenGL and GLFW yet I see no VAPI for these. I don’t know if this makes any difference but I am using meson. I either get an error suggesting no run-time dependency can be found using pkgconfig or cmake. Then if I use the actual lib name I get an error regarding no VAPI.
I hope someone can clear this up for me.
Kirk
Can you give a small contained meson sample reproducing this behaviour ?
I have only just started learning meson so I might be doing something wrong here.
project('sdl_test', 'c', 'vala')
dependencies = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('sdl')
]
sources = [
'src/main.vala'
]
executable('sdl_test', sources, dependencies: dependencies)
meson.build:3:0: ERROR: Dependency "sdl" not found, tried pkgconfig and cmake
I don’t have any sdl library installed only sdl2 and if I change the meson file to use sdl2:
project('sdl_test', 'c', 'vala')
dependencies = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('sdl2')
]
sources = [
'src/main.vala'
]
executable('sdl_test', sources, dependencies: dependencies)
I get the this error:
error: Package sdl2’ not found in specified Vala API directories or GObject-Introspection GIR directories`
The SDL2 vapi files were added quite recently to the main vala repository (committed one month ago), so depending where you’re installing vala from, you might not have a recent enough version. It was previously in the vapi-extras, so you’ll probably need to install this distro package to have it.
Thank you I didn’t realize there was another repo for Vala vapi’s.