You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having quite some trouble getting doctest to work with a dll. My dll consists only of the code from executable_dll_and_plugin/dll.cpp with the latest doctest.h file. Compiling this with VS2019 yields:
1>------ Build started: Project: sandbox_lib, Configuration: Debug x64 ------
1>math.cpp
1> Creating library C:\...\vs_solution\x64\Debug\sandbox_lib.lib and object C:\...\vs_solution\x64\Debug\sandbox_lib.exp
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct doctest::detail::TestSuite & __cdecl doctest::detail::TestSuite::operator*(char const *)" (__imp_??DTestSuite@detail@doctest@@QEAAAEAU012@PEBD@Z) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_0''(void)" (??__E_DOCTEST_ANON_VAR_0@@YAXXZ)
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl doctest::detail::TestCase::TestCase(void (__cdecl*)(void),char const *,unsigned int,struct doctest::detail::TestSuite const &,char const *,int)" (__imp_??0TestCase@detail@doctest@@QEAA@P6AXXZPEBDIAEBUTestSuite@12@1H@Z) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_3''(void)" (??__E_DOCTEST_ANON_VAR_3@@YAXXZ)
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct doctest::detail::TestCase & __cdecl doctest::detail::TestCase::operator*(char const *)" (__imp_??DTestCase@detail@doctest@@QEAAAEAU012@PEBD@Z) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_3''(void)" (??__E_DOCTEST_ANON_VAR_3@@YAXXZ)
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl doctest::detail::TestCase::~TestCase(void)" (__imp_??1TestCase@detail@doctest@@QEAA@XZ) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_3''(void)" (??__E_DOCTEST_ANON_VAR_3@@YAXXZ)
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl doctest::detail::regTest(struct doctest::detail::TestCase const &)" (__imp_?regTest@detail@doctest@@YAHAEBUTestCase@12@@Z) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_3''(void)" (??__E_DOCTEST_ANON_VAR_3@@YAXXZ)
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl doctest::detail::setTestSuite(struct doctest::detail::TestSuite const &)" (__imp_?setTestSuite@detail@doctest@@YAHAEBUTestSuite@12@@Z) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_0''(void)" (??__E_DOCTEST_ANON_VAR_0@@YAXXZ)
1>math.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct doctest::detail::TestSuite & __cdecl doctest_detail_test_suite_ns::getCurrentTestSuite(void)" (__imp_?getCurrentTestSuite@doctest_detail_test_suite_ns@@YAAEAUTestSuite@detail@doctest@@XZ) referenced in function "void __cdecl `dynamic initializer for '_DOCTEST_ANON_VAR_3''(void)" (??__E_DOCTEST_ANON_VAR_3@@YAXXZ)
1>C:\...\vs_solution\x64\Debug\sandbox_lib.dll : fatal error LNK1120: 7 unresolved externals
1>Done building project "sandbox_lib.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Which seems apparently to be the case because the definitions are hidden by macro magic.
Extra information
latest doctest.h
VS2019 16.4 or so
Win10
edit: seems to work if I chose static lib instead of dynamic in VS.
The text was updated successfully, but these errors were encountered:
The reason is that the dll project links to the implementation where the test runner of doctest resides - have a look at the accompanying CMakeLists.txt file - every binary which uses doctest links to it - even the plugin which is loaded at runtime.
Description
I'm having quite some trouble getting doctest to work with a dll. My dll consists only of the code from executable_dll_and_plugin/dll.cpp with the latest doctest.h file. Compiling this with VS2019 yields:
Which seems apparently to be the case because the definitions are hidden by macro magic.
Extra information
edit: seems to work if I chose static lib instead of dynamic in VS.
The text was updated successfully, but these errors were encountered: