今天试了一下C/C++混合编程,然后就出现了上面那个蛋疼的问题,去网上查了一下,发现原来是C语言和C++预编译头的问题。
error:预编译头文件来自编译器的早期版本,或者预编译头为 C++ 而在 C 中使用它(或相反)
英文版:fatal error C1853: 'pjtname.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
或者fatal error C1853: 'xxx.pch' is not a precompiled header file created with this compiler.
这个问题是在VS项目中同时有.c和.cpp文件时,编译器会对它们采用不同的编译方式(主要因为函数声明的处理方式不同,C语言没有多态,函数名编译后比较正常,而C++有多态的特性,所以编译之后函数名面目全非)。
那么预编译头是什么鬼?