../src/gtest.cc:364: warning: missing initializer for member ‘testing::internal::MutexBase::owner_’

586 views
Skip to first unread message

Peng Yu

unread,
Aug 5, 2012, 10:07:00 AM8/5/12
to Google C++ Testing Framework
I see the above warnings. Would anybody let me know how to fix it?
Thanks!

~/dvcs_src/googletest-read-only/make$ make
g++ -I../include -g -Wall -Wextra -c ../samples/sample1.cc
g++ -I../include -g -Wall -Wextra -c ../samples/sample1_unittest.cc
g++ -I../include -I.. -g -Wall -Wextra -c \
../src/gtest-all.cc
In file included from ../src/gtest-all.cc:42:
../src/gtest.cc:364: warning: missing initializer for member
‘testing::internal::MutexBase::owner_’
g++ -I../include -I.. -g -Wall -Wextra -c \
../src/gtest_main.cc
ar rv gtest_main.a gtest-all.o gtest_main.o
ar: creating archive gtest_main.a
a - gtest-all.o
a - gtest_main.o
g++ -I../include -g -Wall -Wextra -lpthread sample1.o
sample1_unittest.o gtest_main.a -o sample1_unittest

Greg Miller

unread,
Aug 6, 2012, 10:41:57 AM8/6/12
to Peng Yu, Google C++ Testing Framework
Are you using the latest gtest code?

My guess is that the error is caused by the use of -Wextra which includes the -Wmissing-field-initializers flag. See: http://code.google.com/p/googletest/source/search?q=missing-field-initializers&origq=missing-field-initializers&btnG=Search+Trunk

If you add -Wno-missing-field-initializers to your compiler flags it should work. This has already been done in gtest's own cmake scripts.

HTH,
Greg
Reply all
Reply to author
Forward
0 new messages