小编Ger*_*abó的帖子

'dummy' 可以在未初始化的情况下使用

我在运行 clion 项目 stepik 文件时遇到问题。不断出现以下错误。我有一个编译器,我可以运行其他代码,但有些代码不起作用。

\n
In file included from /home/gergoszabo/CLionProjects/Prog2_08/test-framework/googletest-src/googletest/src/gtest-all.cc:42:\n/home/gergoszabo/CLionProjects/Prog2_08/test-framework/googletest-src/googletest/src/gtest-death-test.cc: In function \xe2\x80\x98bool testing::internal::StackGrowsDown()\xe2\x80\x99:\n/home/gergoszabo/CLionProjects/Prog2_08/test-framework/googletest-src/googletest/src/gtest-death-test.cc:1224:24: error: \xe2\x80\x98dummy\xe2\x80\x99 may be used uninitialized [-Werror=maybe-uninitialized]\n 1224 |   StackLowerThanAddress(&dummy, &result);\n      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~\n/home/gergoszabo/CLionProjects/Prog2_08/test-framework/googletest-src/googletest/src/gtest-death-test.cc:1214:13: note: by argument 1 of type \xe2\x80\x98const void*\xe2\x80\x99 to \xe2\x80\x98void testing::internal::StackLowerThanAddress(const void*, bool*)\xe2\x80\x99 declared here\n 1214 | static void StackLowerThanAddress(const void* ptr, bool* result) {\n      |             ^~~~~~~~~~~~~~~~~~~~~\n/home/gergoszabo/CLionProjects/Prog2_08/test-framework/googletest-src/googletest/src/gtest-death-test.cc:1222:7: note: \xe2\x80\x98dummy\xe2\x80\x99 declared here\n 1222 |   int dummy;\n      |       ^~~~~\ncc1plus: all warnings being treated as errors\ngmake[3]: *** [../test-framework/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/build.make:72: ../test-framework/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1\ngmake[2]: *** [CMakeFiles/Makefile2:587: ../test-framework/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/all] Error …
Run Code Online (Sandbox Code Playgroud)

c++ g++ cmake clion

4
推荐指数
1
解决办法
5626
查看次数

标签 统计

c++ ×1

clion ×1

cmake ×1

g++ ×1