Upgrade to Catch2 Version 3

- May 23, 2022

When upgrading from Catch2 (version 2) to Catch2 (version 3), there may be an error building/linking the tests.

An unresolved symbol to __scrt_common_main_seh may appear.

1>MSVCRT.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@YAHXZ)
1>C:\Projects\Tests\Test.exe : fatal error LNK1120: 1 unresolved externals

In the case of vcpkg with CMake, Catch2::Catch2WithMain, must be added to target_link_libraries.

find_package(Catch2 CONFIG REQUIRED)

target_link_libraries(ServerLogUnitTest
	PUBLIC
		${SERVERLOG_NAME}
	PRIVATE
		Catch2::Catch2
		Catch2::Catch2WithMain
)

See Also

Comments

Any comments? Create a new discussion on GitHub.
There used to be an inline comment form here, but it was removed.