Compile the line below Sv/feature/Cluster
Rc = ns_cluster_insert2db (key_image); error:
Test. c | 47 | error: Invalid conversion from 'Char ** 'to 'const char **'
However, in my test program, I only gave a warning:
- # Include <stdio. h>
- Int main (){
- Char ** _ P;
- Fun (_ P );
- }
- Void fun (const char ** p ){
- Printf ("test/N ");
- }
- ~
- ~
I checked the c faq. I have not understood the following section:
11.10 why can't I pass in char ** to a function that accepts const char **?
You can pass the T pointer to the place where the const-T pointer is accepted (applicable to any type of T ). However
Yes. This rule allows slight unmatched types of pointers with modifiers (obvious exceptions) but cannot be recursive.
Application, but only for the top layer.
If you must assign a value or pass a pointer that does not match the modifier in addition to the top layer, you must specify
Use type conversion (in this example, use (const char **).
There are also deep-seated problems that cannot be fixed by conversion.
References: [ISO, sec. 6.1.2.6, sec. 6.3.16.1, sec. 6.5.3]; [H & S, sec. 7.9.1 pp.
221-2]
Find the cause of the problem. Test. C is compiled using gcc, but the call of the ns_cluster_insert2db (key_image) function is the shared library libnscluster compiled by G ++. so is provided, so the ns_cluster_insert2db function processes input parameters in C ++ mode, and the type conversion rules of C ++ are more strict, so compile test. the invalid Conversion error occurs in C.
The following is part of makefile:
Libnscluster. So: $ (SRC)
G ++-shared-o $ ^ $ (libpath) $ (LIB) $ (include)
Test: Test. c libnscluster. So
Gcc-g-o $ @ $ <$ (include) $ (libpath) $ (LIB)-llpool-lnsrcluster