GoogleTest tutorial crashes with shared library on Windows?

I followed the (excellent) tutorial here https://www.jetbrains.com/help/clion/unit-testing-tutorial.html and got it all to work as promised.

I changed one word in DateConverter_lib\CMakeLists.txt

add_library(DateConverter_lib STATIC

to
add_library(DateConverter_lib SHARED

The project builds but no longer runs, printing "Test framework quit unexpectedly C000 0135 ...," which, apparently, is a failure to load the DLL (shared library)

Any advice for me?

0

Hi!

As per https://stackoverflow.com/a/12546288, you can try adding `set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)` to your CMakeLists.txt.

0

请先登录再写评论。