【发布时间】:2013-08-28 17:42:56
【问题描述】:
我正在尝试使用 makefile 来编译其他人使用 cygwin 编写的程序。我收到很多错误消息,其中很多人抱怨error: template with C linkage。
搜索了一下,似乎问题与extern "C"有关。此行包含在文件 cygwin/usr/include/pthread.h 中,该文件包含在其中一个标题中的 #include < pthread.h > 中。当我删除此行时,大多数错误消息都会消失。但还剩下一些,如下所示:
/usr/include/pthread.h:67:5: error: previous declaration of ‘int pthread_atfork(void (* )(),void ( *)(), void ( *)())’ with ‘C++’ linkage
/usr/include/sys/unistd.h:136:5: error: conflicts with new declaration with ‘C’ linkage
有谁知道如何解决这个问题?我很想坐下来详细了解所有这些东西,但我没有时间运行这个程序。
【问题讨论】:
-
如果没有看到您尝试编译的实际代码,我们无能为力。
-
不要修改
pthread.h,这很可能是正确的,您需要弄清楚为什么会得到最可能不存在的原始错误。我要寻找的第一个候选者是宏。
标签: c++ c header-files extern