gtest and gmock as shared dlls on windows - latest master linking errors gmock
- Dominant language
- C++
- Stars
- 39.5k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
hi,
i get these linking errors:
3>NumberingTestFixture.obj : error LNK2001: unresolved external symbol "class testing::internal::Mutex testing::internal::g_gmock_mutex" (?g_gmock_mutex@internal@testing@@3VMutex@12@A)
3>NumberingTestFixture.obj : error LNK2001: unresolved external symbol "class testing::internal::ThreadLocal testing::internal::g_gmock_implicit_sequence" (?g_gmock_implicit_sequence@internal@testing@@3V?$ThreadLocal@PEAVSequence@testing@@@12@A)
3>D:\prod\structures\BuildDrop\Work\bin_x64\NumberingTest.exe : fatal error LNK1120: 2 unresolved externals
class MockDatabaseHelper_i : public numbering::DatabaseHelper_i {
public:
MOCK_METHOD1(GetLock,
numbering::SharedLock_c(dbMultiUserLockRetryCallback_t LockRetryCallback));
MOCK_METHOD0(AreEnoughPrivileges,
bool());
MOCK_CONST_METHOD0(IsServerConnectionOk,
bool());
};
Using:
MockDatabaseHelper_i Db;
EXPECT_CALL(Db, GetLock(::testing::_)).Times(1).WillOnce(::testing::Return(numbering::SharedLock_c(new Lock_c())));
I did generate the mock with gmock generator... the funny part is that we have tons of gmock code in other projects that compile and link just fine.
Do you have any idea whats going on here?
thanks
Contributor guide
Research direction
Start by reproducing the Windows shared-DLL link failure with the shown MockDatabaseHelper_i example and inspect how gtest and gmock are built and linked. Trace the unresolved g_gmock_mutex and g_gmock_implicit_sequence symbols; done means the example links successfully against the shared DLL configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, operating-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100