久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

cocos2d

 百草園404 2018-09-15

  在用cocos2d-x3.2 + protobuf編譯Android項(xiàng)目的時(shí)候,,protobuf出現(xiàn)了兩個問題:

 

1. 首先是config.h找不到,,查閱自后說是通過命令或工具生成的,,里面的內(nèi)容根據(jù)不同平臺是不一樣的(引用一些用到的庫,,例如hash_map,hash_set等,,和部分宏定義),,那么就要在自己手動生成,,或者自己創(chuàng)建一個空的config,自己把一些引用到的庫加進(jìn)去,,為了能快速編譯通過,,我就自己創(chuàng)建了一個config.h,沒有引用任何庫,。

 

  1. #ifndef _LINUX_CONFIG_H
  2. #define _LINUX_CONFIG_H

  3. #endif

然后找不到config.h的問題解決了,。

 

2.  然后是error "No suitable threading library available."

定位到common.cc文件中

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN // We only need minimal includes
#include <windows.h>
#define snprintf _snprintf // see comment in strutil.cc
#elif defined(HAVE_PTHREAD)
#include <pthread.h>
#else
#error "No suitable threading library available."
#endif

發(fā)現(xiàn)是找不到HAVE_PTHREAD宏定義,導(dǎo)致沒有引用pthread庫,,直接用#include <pthread.h>替換#error "No suitable threading library available."這句代碼,,又會導(dǎo)致其他文件找不到;那么可能其它地方也引用了HAVE_PTHREAD宏,,那這個宏是protobuf庫根據(jù)不同平臺定義的呢,,還是該我們自己加呢,如果是自己加又應(yīng)該加在哪里呢,?

聯(lián)想到config文件找不到的問題,,猜到可能是config文件中缺少一些代碼,看來不能用空的config,,那么就直接在config.h中加上 #define HAVE_PTHREAD 即可,。

  1. #ifndef _LINUX_CONFIG_H
  2. #define _LINUX_CONFIG_H

  3. #define HAVE_PTHREAD

  4. #endif

 之后編譯通過。,。,。

 

如果是有完美強(qiáng)迫癥的、或者要求高效率(使用hash_map/unordered_map等),,那么就在linux上用configure生成一個config.h吧,,下面附上一個完整生成的:

  1. /* config.h. Generated from config.h.in by configure. */
  2. /* config.h.in. Generated from configure.ac by autoheader. */

  3. /* the name of <hash_map> */
  4. #define HASH_MAP_CLASS hash_map

  5. /* the location of <unordered_map> or <hash_map> */
  6. #define HASH_MAP_H <ext/hash_map>

  7. /* the namespace of hash_map/hash_set */
  8. #define HASH_NAMESPACE std::tr1

  9. /* the name of <hash_set> */
  10. #define HASH_SET_CLASS hash_set

  11. /* the location of <unordered_set> or <hash_set> */
  12. #define HASH_SET_H <ext/hash_set>

  13. /* Define to 1 if you have the <dlfcn.h> header file. */
  14. #define HAVE_DLFCN_H 1

  15. /* Define to 1 if you have the <fcntl.h> header file. */
  16. #define HAVE_FCNTL_H 1

  17. /* Define to 1 if you have the `ftruncate' function. */
  18. #define HAVE_FTRUNCATE 1

  19. /* define if the compiler has hash_map */
  20. #define HAVE_HASH_MAP 1

  21. /* define if the compiler has hash_set */
  22. #define HAVE_HASH_SET 1

  23. /* Define to 1 if you have the <inttypes.h> header file. */
  24. #define HAVE_INTTYPES_H 1

  25. /* Define to 1 if you have the <limits.h> header file. */
  26. #define HAVE_LIMITS_H 1

  27. /* Define to 1 if you have the <memory.h> header file. */
  28. #define HAVE_MEMORY_H 1

  29. /* Define to 1 if you have the `memset' function. */
  30. #define HAVE_MEMSET 1

  31. /* Define to 1 if you have the `mkdir' function. */
  32. #define HAVE_MKDIR 1

  33. /* Define if you have POSIX threads libraries and header files. */
  34. #define HAVE_PTHREAD 1

  35. /* Define to 1 if you have the <stdint.h> header file. */
  36. #define HAVE_STDINT_H 1

  37. /* Define to 1 if you have the <stdlib.h> header file. */
  38. #define HAVE_STDLIB_H 1

  39. /* Define to 1 if you have the `strchr' function. */
  40. #define HAVE_STRCHR 1

  41. /* Define to 1 if you have the `strerror' function. */
  42. #define HAVE_STRERROR 1

  43. /* Define to 1 if you have the <strings.h> header file. */
  44. #define HAVE_STRINGS_H 1

  45. /* Define to 1 if you have the <string.h> header file. */
  46. #define HAVE_STRING_H 1

  47. /* Define to 1 if you have the `strtol' function. */
  48. #define HAVE_STRTOL 1

  49. /* Define to 1 if you have the <sys/stat.h> header file. */
  50. #define HAVE_SYS_STAT_H 1

  51. /* Define to 1 if you have the <sys/types.h> header file. */
  52. #define HAVE_SYS_TYPES_H 1

  53. /* Define to 1 if you have the <unistd.h> header file. */
  54. #define HAVE_UNISTD_H 1

  55. /* Enable classes using zlib compression. */
  56. /* #undef HAVE_ZLIB */

  57. /* Define to the sub-directory in which libtool stores uninstalled libraries.
  58. */
  59. #define LT_OBJDIR ".libs/"

  60. /* Name of package */
  61. #define PACKAGE "protobuf"

  62. /* Define to the address where bug reports for this package should be sent. */
  63. #define PACKAGE_BUGREPORT "[email protected]"

  64. /* Define to the full name of this package. */
  65. #define PACKAGE_NAME "Protocol Buffers"

  66. /* Define to the full name and version of this package. */
  67. #define PACKAGE_STRING "Protocol Buffers 2.5.0"

  68. /* Define to the one symbol short name of this package. */
  69. #define PACKAGE_TARNAME "protobuf"

  70. /* Define to the home page for this package. */
  71. #define PACKAGE_URL ""

  72. /* Define to the version of this package. */
  73. #define PACKAGE_VERSION "2.5.0"

  74. /* Define to necessary symbol if this constant uses a non-standard name on
  75. your system. */
  76. /* #undef PTHREAD_CREATE_JOINABLE */

  77. /* Define to 1 if you have the ANSI C header files. */
  78. #define STDC_HEADERS 1

  79. /* Enable extensions on AIX 3, Interix. */
  80. #ifndef _ALL_SOURCE
  81. # define _ALL_SOURCE 1
  82. #endif
  83. /* Enable GNU extensions on systems that have them. */
  84. #ifndef _GNU_SOURCE
  85. # define _GNU_SOURCE 1
  86. #endif
  87. /* Enable threading extensions on Solaris. */
  88. #ifndef _POSIX_PTHREAD_SEMANTICS
  89. # define _POSIX_PTHREAD_SEMANTICS 1
  90. #endif
  91. /* Enable extensions on HP NonStop. */
  92. #ifndef _TANDEM_SOURCE
  93. # define _TANDEM_SOURCE 1
  94. #endif
  95. /* Enable general extensions on Solaris. */
  96. #ifndef __EXTENSIONS__
  97. # define __EXTENSIONS__ 1
  98. #endif


  99. /* Version number of package */
  100. #define VERSION "2.5.0"

  101. /* Define to 1 if on MINIX. */
  102. /* #undef _MINIX */

  103. /* Define to 2 if the system does not provide POSIX.1 features except with
  104. this defined. */
  105. /* #undef _POSIX_1_SOURCE */

  106. /* Define to 1 if you need to in order for `stat' and other things to work. */
  107. /* #undef _POSIX_SOURCE */

  

 

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多