What should I do if I have a compilation error that I do not understand in PolySpace for C/C++ 7.0 (R2009a)?

4 visualizzazioni (ultimi 30 giorni)
As an example, I have a simple test.c file :
 
#include <rpc/xdr.h>
int main(void) { return 0;}
During compilation I get the following error :
 
/usr/local/PolySpace/PolySpaceForCandCPP_R2009a/Verifier/include/include-linux/rpc/xdr.h, line 121 (column 43): Error: missing parameter 3 type
/usr/local/PolySpace/PolySpaceForCandCPP_R2009a/Verifier/include/include-linux/rpc/xdr.h, line 121 (column 51): Error: syntax error; found `__addr' expecting `)'
| (/usr/local/PolySpace/PolySpaceForCandCPP_R2009a/Verifier/include/include-linux/rpc/xdr.h is included by test.c)
/usr/local/PolySpace/PolySpaceForCandCPP_R2009a/Verifier/include/include-linux/rpc/xdr.h, line 121 (column 51): Error: skipping `__addr' `,' `u_int' `__len'
/usr/local/PolySpace/PolySpaceForCandCPP_R2009a/Verifier/include/include-linux/rpc/xdr.h, line 125 (column 9): Error: missing parameter 4 type
/usr/local/PolySpace/PolySpaceForCandCPP_R2009a/Verifier/include/include-linux/rpc/xdr.h, line 125 (column 15): Error: syntax error; found `__len' expecting `)'
|
I am not sure what this error means.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 4 Ott 2017
When PolySpace throws an error at compile time, it can be useful to look at the preprocessed code.
The preprocessed code is stored as preprocessed file located in the "results directory"/C-ALL/ or in "results directory"/ALL/SRC/MACROS.
These files have a .ci extension and looking at it can help to find errors.
For instance, in the previous example, you would see that test.ci file located in "results directory"/C-ALL does not define 'u_int' type, i.e. third parameter type of function pointer declared at line 121 of xdr.h. Now that the root cause has been identified, there are many ways to workaround this such as using PolySpace options like -D or adding type in a header file and use of option -include. Also as the header was missing in .c file where type has been declared, it is sufficient to add it using #include.
Most of the time using this step i.e. looking into preprocessed file, helps to understand many of compilation errors given by PolySpace.

Più risposte (0)

Prodotti


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by