Using CMake through VisualStudio 2022 Enterprise, running a gtest executable through the VS test window will often just lock up by a non-existent process and will not allow building/rebuilding the test project.
It will give a link error ‘LNK1168 cannot open [gtest_name.exe] for writing’, sometimes it’s resolved after a few minutes (just on it’s own).
I’m compiling gtest from source, using gtest_main and just implementing my tests using the macros and some fixtures here and there.
Can’t find the process anywhere (task manager, resource monitor), can’t delete the exe directly (says ‘file in use by [gtest_name.exe]…’)
Sometimes it will happen and rebuilding the entire project will get rid of the link error and delete the executable, sometimes the only solution is to restart the PC
This does not happen with other non-gtest executables, and only through the test window in Visual Studio when running googletest.
I’m really stumped by this, I can’t tell if it’s a problem with gtest, visual studio, or with my test specifically.
Though it does happen in ALL the gtest exes which are testing different and unrelated sections so I doubt it has something to do with the tested code specifically.
Daniel Belokon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.