Parasoft C/C++ Test error: expected an identifier extern "C" {
Options
When I tried to run unit test for a simple main program in C++:
#include <iostream>
int main()
{
std::cout << "hello world" << std::endl;
return 0;
}
it occurred the following problem:
C++test analysis errors in /Demo_aCpp
1. Test execution: error preparing instrumentation / symbols data for file.
"/usr/include/sys/features.h", line 25: error: expected an identifier
extern "C" {
^
"/usr/include/sys/features.h", line 25: error: expected a ";"
extern "C" {
^
"/usr/include/sys/reent.h", line 9: error: expected an identifier
extern "C" {
^
"/usr/include/sys/reent.h", line 9: error: expected a ";"
extern "C" {
^
...
Error limit reached.
100 errors detected in the compilation of "C:\Users\username\AppData\Local\Temp\ParaSoft.1840.28297.c".
Compilation terminated.
Any hint on this? Thanks in advance
Tagged:
0
Comments
-
The origin source file is ending in
.cpp, but the temp file that autogenerated by the Parasoft C/C++ Test is ending in.c. So the actually compiled file was the temp file, and the compiler is C-compiler, C-compiler cannot understand extern "C", then the error occurred. Is this right?0 -
The initial problem is this :
C++test analysis errors in /BugDetectiveCpp 1. Test execution: error preparing instrumentation / symbols data for file. In file included from D:\Applications\Cygwin32\home\Parasoft\9.4\engine\etc\safestubs\safe_stubs_win32.c:7:0: /home/Parasoft/9.4/engine/runtime/include/cpptest.h:16:12: fatal error: exception: No such file or directory # include <exception> ^~~~~~~~~~~ compilation terminated. Error preprocessing file "D:\Applications\Cygwin32\home\Parasoft\9.4\engine\etc\safestubs\safe_stubs_win32.c": Process exited with code: 1I fixed this by including absolute path.
0