Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite-orm fails to compile under uwp #1252

Closed
jimwang118 opened this issue Nov 29, 2023 · 6 comments · Fixed by #1295
Closed

sqlite-orm fails to compile under uwp #1252

jimwang118 opened this issue Nov 29, 2023 · 6 comments · Fixed by #1295

Comments

@jimwang118
Copy link

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?

@trueqbit
Copy link
Collaborator

trueqbit commented Nov 29, 2023

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)

@fnc12
Copy link
Owner

fnc12 commented May 16, 2024

@jimwang118 does it work now?

@jimwang118
Copy link
Author

@jimwang118 does it work now?

Still the compilation failed.

@trueqbit
Copy link
Collaborator

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.

@trueqbit
Copy link
Collaborator

@jimwang118 I have tested the “x64-uwp” triplet, but it would be good if you could check that too.

@trueqbit
Copy link
Collaborator

Thanks @jimwang118 and @RealChuan for making sure this works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants