Knowledge points of c++ & c mixed engineering

1    #ifdef  __cplusplus

2    extern "C" {

3    #endif 

4        int main(int argc,char **argv)

5       {

6 code N lines;

7        }

8    #ifdef __cplusplush

9        }

10    #endif


When there is both c++ and c in a project, if a certain piece of code (lines 4-7 in the text) needs to specify the use of the C language interpreter, then 1-3 and 8-9 are needed to put the The content in the middle is wrapped.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324692577&siteId=291194637