sqlite_orm
sqlite_orm copied to clipboard
sqlite-orm fails to compile under uwp
When I failed to compile sqlite-orm under uwp, the error message is as follows.
MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
tests\unit_tests.exe : fatal error LNK1120: 1 unresolved externals
ninja: build stopped: subcommand failed.
I have enabled the test
feature. This feature generates the unit_tests.exe
executable program, but under uwp there is an error message indicating that there is no corresponding executable main function entry? Is this a normal design or is it a problem?
We are using Catch2 v3 for unit testing. Do you know whether it is supported on UWP, or whether it needs special handling?
tests\CMakeLists.txt links against Catch2::Catch2WithMain
:
target_link_libraries(unit_tests PRIVATE sqlite_orm Catch2::Catch2WithMain)
@jimwang118 does it work now?
@jimwang118 does it work now?
Still the compilation failed.
vcpkg's “x64-uwp” triplet sets the CMake variable CMAKE_SYSTEM_NAME=WindowsStore
, which instructs CMake to add the /D_UNICODE
and /DUNICODE
compiler flags. Catch2 v3 will then provide a definition of wmain()
instead of main()
.
For some reason, the msvc linker will not take wmain()
from a static library.
PR #1295 explicitly sets the entry point of the unit test executable file.
@jimwang118 I have tested the “x64-uwp” triplet, but it would be good if you could check that too.
Thanks @jimwang118 and @RealChuan for making sure this works.