Using this meson file,
project('mytest', 'c')
cc = meson.get_compiler('c')
deps = []
deps += dependency('sdl2',
required: true,
static: true,
method: 'pkg-config')
executable('demo',
'src/main.c',
dependencies : deps,
gui_app: true)
I get the following error
error LNK2019: unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
This seems to be related to the SDLmain.lib
(I'm sure it exist).
How would you force the linker to link to this library?
I'm on windows 10, using the MSVC compiler.
You're building a gui app, not a terminal app. With MSVC, when you set gui_app : true
(or in more recent versions of meson win_subsystem : 'windows'
) you don't provide a main
function, you provide WinMain
function instead.
Under the hood this option is passing /SUBSYSTEM:WINDOWS
to the compiler