
C/C++
燃烧的冷水
这个作者很懒,什么都没留下…
展开
-
g++链接gcc编译的库报错“undefined reference to xxx”
明明头文件已经包含,却还报错“undefined reference to xxx”,除了库没有正确链接外,还有可能是编译器的关系问题:在编译可执行文件时,需要链接一个静态库.a文件,在反复确认makefile已经添加正确,头文件也已经包含,却还是报错。后来发现这个.a文件使用的*.o是使用gcc编译的,而编译时可执行文件使用g++。以下称.a文件所用工程为工程A,可执行文件所用工程为工程B。尝试...原创 2018-04-19 15:41:05 · 3620 阅读 · 0 评论 -
pthread_kill导致程序崩溃 Segmentation fault
pthread_t thread_id;printf("thread = %d\n",pthread_kill(thread_id,0));上述用法,在未对一个pthread_t执行pthread_create前调用pthread_kill,会出现Segmentation faultgoogle上摘录如下解释:pthread_t is not a thread ID, or a numeric i...转载 2018-04-20 11:26:10 · 5067 阅读 · 0 评论