Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Issue running unit tests (cpptest) using C++Test (9.6) and Cygwin (GCC 6.4)

Disclaimer: I have not used C++Test in the past.

I have installed Cygwin with GCC version 6.4.0 but the latest version of the GCC toolchain that C++Test version 9.6 seems to support is 4.9.x. I haven't figured out how to install an older version of GCC to match C++test requirements.

I figured that I could run static analysis by passing the -std=c++14 compiler flag and setting the C++Test compiler settings to GNU GCC 4.9.x (i.e forcing GCC to be mostly compatible). I can also generate unit tests without setup issues.

Unfortunately, as soon as I try generate stubs or run unit tests, I encounter issues with the cpptest library, which complains about the -std=c++14 flag, see output below.

cc1: warning: command line option '-std=c++14' is valid for C++/ObjC++ but not for C
"/usr/include/stdlib.h", line 107: error: duplicate parameter name
  int __attribute__((__cdecl__)) mbtowc (wchar_t *restrict, const char *restrict, size_t);

Any suggestions as to how I can setup a compatible GCC toolchain for unit testing.

Comments