Open upnplib opened 3 years ago
Please share your CMake files and details about how you are using GoogleTest (is it installed, etc...).
I think I might be running into this same issue, on Linux though. I'm getting this error
src/main_tests.cpp:32:18: error: use of undeclared identifier 'death_test_style'
GTEST_FLAG_SET(death_test_style, "threadsafe");
^
1 error generated.
make: *** [Makefile:165: src/main_tests.o] Error 1
Here's the compile command that was used
CC -lgtest -I/sw/spock/spack-envs/base/opt/linux-sles15-x86_64/gcc-7.5.0/googletest-1.11.0-xgcobwe63kttlqkm3z6ujt5faiooviqf/include -L/sw/spock/spack-envs/base/opt/linux-sles15-x86_64/gcc-7.5.0/googletest-1.11.0-xgcobwe63kttlqkm3z6ujt5faiooviqf/lib64 -lpthread -lhdf5_cpp -Ofast -std=c++11 -fopenmp -DHYDRO_GPU -DCUDA -DMPI_CHOLLA -DBLOCK -DPRECISION=2 -DPPMP -DHLLC -DVL -DDENSITY_FLOOR -DTEMPERATURE_FLOOR -DDE -DCPU_TIME -DOUTPUT -DHDF5 -DMPI_GPU -DPARALLEL_OMP -DN_OMP_THREADS=8 -DO_HIP -Isrc -I/opt/cray/pe/hdf5/1.12.0.6/crayclang/10.0/include -fopenmp -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I"/opt/rocm-4.2.0/hip/include" -I"/opt/rocm-4.2.0/llvm/bin/../lib/clang/12.0.0" -I/opt/rocm-4.2.0/include -c src/main_tests.cpp -o src/main_tests.o
Googletest is installed as a module on a HPC cluster, I don't know any details about how it was installed unfortunately.
Here's the entirety of my main tests function. What other information do you require?
// External Libraries and Headers
#include <gtest/gtest.h>
// Local includes
#include "utils/testing_utilities.h"
/// This is the global variable to store the path to the root of Cholla
testingUtilities::GlobalString globalChollaRoot;
testingUtilities::GlobalString globalChollaBuild;
testingUtilities::GlobalString globalChollaMachine;
/*!
* \brief The main function for testing
*
* \param argc The number of CLI arguments
* \param argv A list of the CLI arguments
* \return int
*/
int main(int argc, char **argv) {
// First we initialize Googletest. Note, this removes all gtest related
// arguments from argv and argc
::testing::InitGoogleTest(&argc, argv);
GTEST_FLAG_SET(death_test_style, "threadsafe");
// Initialize the global cholla root path variable
globalChollaRoot.initPath("/ccs/home/rcaddy/Code/cholla");
globalChollaBuild.initPath("hydro");
globalChollaMachine.initPath("spock");
// Run test and return result
return RUN_ALL_TESTS();
}
// GTEST_LINKED_AS_SHARED_LIBRARY
// - Define to 1 when compiling tests that use
// Google Test as a shared library (known as
// DLL on Windows).
Need to define on dependent target to import symbols defined in gtest and link successfully.
Describe the bug I add
GTEST_FLAG_SET(death_test_style, "threadsafe");
tomain()
of a gtest as shown at Death Test Styles:This compiles on Linux (Debian Bullseye) without any errors. On Microsoft Windows I get:
I expect it to compiles without errors, like it does on Linux.
Steps to reproduce the bug On MS Windows 10 add the line
GTEST_FLAG_SET(death_test_style, "threadsafe");
tomain()
as shown above to an existing gtest that compiles before without errors.Does the bug persist in the most recent commit? Yes.
What operating system and version are you using? i use Microsoft Windows 10 with Microsoft Visual Studio 2019 Community version and selected the default development command line environment
as described at https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160#use-the-developer-tools-in-an-existing-command-window
What compiler and version are you using?
What build system are you using?