Chinaunix首页 | 论坛 | 博客
  • 博客访问: 119526
  • 博文数量: 39
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 375
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-15 22:27
文章分类
文章存档

2018年(2)

2017年(37)

我的朋友

分类: C/C++

2017-09-07 09:25:45

可以使用如下形式
语言所引用的头文件必须在extern "C"{ 里面,#include 必须在extern "C"{上面

点击(此处)折叠或打开

  1. #pragma once

  2. #include <iostream>

  3. using namespace std;



  4. #ifdef __cplusplus

  5. extern "C"{

  6. #include <pthread.h>

  7. #include <unistd.h>

  8. #include <sys/types.h>

  9. #include <sys/socket.h>

  10. #include <netinet/in.h>

  11. #include <netinet/ip.h> /* superset of previous */

  12. #include <string.h>

  13. #include <stdlib.h>

  14. #include <stdio.h>

  15. #include <ifaddrs.h>

  16. #include <arpa/inet.h>

  17. #include <unistd.h>

  18. #include <stdlib.h>

  19. #include <time.h>

  20. #include <sys/vfs.h>

  21. #include <signal.h>

  22. #include <sys/stat.h>

  23. #include <sys/socket.h>

  24. #include <arpa/inet.h>

  25. #include <netdb.h>

  26. #include <errno.h>

  27. #endif



  28. #ifdef __cplusplus

  29. }

  30. #endif


阅读(1588) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~