C++ : Unit testing using Google Mock with Code::Blocks, MinGW and C++11 -
C++ : Unit testing using Google Mock with Code::Blocks, MinGW and C++11 -
i've been trying larn unit testing on own next along book.
code in book utilize c++11 standard , have line this:
auto variable = function(parameter);
when first compiled got warning:
warning: 'auto' changes meaning in c++11; please remove [-wc++0x-compat]
no biggie, prepare checking next box in project->build options... menu:
[ ] have g++ follow c++ 11 iso c++ language standard [-std=c++11]
now, however, new errors related google mock in gtest-port.h :
| | in function 'int testing::internal::posix::strcasecmp(const char*, const char*)':
|1719| error: '_stricmp' not declared in scope
| | in function 'char* testing::internal::posix::strdup(const char*)':
|1721| error: '_strdup' not declared in scope
| | in function 'file* testing::internal::posix::fdopen(int, const char*)':|
|1779| error: 'fdopen' not declared in scope
searching problem yielded little me did seek , define target os suggested solution in case not correctly identified automatically. adding gtest_os_windows=1 and/or gtest_os_windows_desktop=1 in projects defines changed nothing.
i realize fixed in instance providing right type instead of using auto i'd find solution if possible. replacing auto , not having -std=c++11 alternative checked makes code work intended library works.
i'm using code::blocks 13.12 , mingw/g++ 4.8.1-4 , google mock 1.7 in windows.
thanks reading =)
the reply here lies in functions missing declarations: _stricmp
, _strdup
, fdopen
. first 2 microsoft versions of posix functions stricmp
, strdup
. note specifying utilize of c++11 iso standard not contain items in posix standard. specifying --std=gnu++11
telling compiler take hybrid of c++11 , posix along gnu extensions.
interestingly cannot replicate gcc 4.8.2 on linux there possibility else going on in google mock headers when compiling on windows.
c++ c++11 mingw codeblocks gmock
Comments
Post a Comment