google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
34.93k stars 10.16k forks source link

[Bug]: DEBUG version cannot parse external symbol: 'testing:: FLAGS_gtest_filter' #4627

Open rememberBr opened 1 month ago

rememberBr commented 1 month ago

Describe the issue

debug.zip When I use gtest for unit testing and want to perform a separate test, I use: testing:: GTEST_LAG (filter). When using the release version of gtest, everything works fine. When using the debug version, it prompts: error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits,class std::allocator > testing::FLAGS_gtest_filter" (?FLAGS_gtest_filter@testing@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) Fatal error LNK1120: 1 unresolved external command

A simple demo that can be used to reproduce bugs can be found in debug. zip

Steps to reproduce the problem

see debug.zip

What version of GoogleTest are you using?

The Linux version also has the same issue.

I have tried versions 1.13, 1.14, and 1.15 of gtest and have encountered this issue.

What operating system and version are you using?

win10 and ubuntu 20.04

What compiler and version are you using?

Linux:gcc version 9.4.0

win10:gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

What build system are you using?

win10 :cmake version 3.30.2

Additional context

No response