预编译头选项是否会导致此错误?

时间:2013-01-03 11:28:47

标签: c++ c visual-c++

我已从crypto.c删除了“使用预编译标题”选项。

enter image description here

如何正确解决此错误?

1 个答案:

答案 0 :(得分:4)

您需要在其标头文件中声明crypt()函数为extern "C",如下所示:

#ifdef __cplusplus
extern "C" {
#endif

void crypt(unsigned int *, unsigned int, unsigned int *);

#ifdef __cplusplus
}
#endif

如果不这样做,C ++编译器会将其视为具有C ++(而不是C)链接的函数,并将对其应用名称修改。